MonoDevelop.CSharp.SignatureMarkupCreator.GetTypeParameterMarkup C# (CSharp) Méthode

GetTypeParameterMarkup() private méthode

private GetTypeParameterMarkup ( ITypeSymbol t ) : string
t ITypeSymbol
Résultat string
		string GetTypeParameterMarkup (ITypeSymbol t)
		{
			if (t == null)
				throw new ArgumentNullException ("t");
			var result = new StringBuilder ();
			var highlightedTypeName = Highlight (FilterEntityName (t.Name), colorStyle.UserTypes);
			result.Append (highlightedTypeName);

			var color = AlphaBlend (colorStyle.PlainText.Foreground, colorStyle.PlainText.Background, optionalAlpha);
			var colorString = MonoDevelop.Components.HelperMethods.GetColorString (color);

			result.Append ("<span foreground=\"" + colorString + "\">" + " (type parameter)</span>");
			var tp = t as ITypeParameterSymbol;
			if (tp != null) {
				if (!tp.HasConstructorConstraint && !tp.HasReferenceTypeConstraint && !tp.HasValueTypeConstraint && tp.ConstraintTypes.All (IsObjectOrValueType))
					return result.ToString ();
				result.AppendLine ();
				result.Append (Highlight (" where ", colorStyle.KeywordContext));
				result.Append (highlightedTypeName);
				result.Append (" : ");
				int constraints = 0;

				if (tp.HasReferenceTypeConstraint) {
					constraints++;
					result.Append (Highlight ("class", colorStyle.KeywordDeclaration));
				} else if (tp.HasValueTypeConstraint) {
					constraints++;
					result.Append (Highlight ("struct", colorStyle.KeywordDeclaration));
				}
				foreach (var bt in tp.ConstraintTypes) {
					if (!IsObjectOrValueType (bt)) {
						if (constraints > 0) {
							result.Append (",");
							if (constraints % 5 == 0) {
								result.AppendLine ();
								result.Append ("\t");
							}
						}
						constraints++;
						result.Append (GetTypeReferenceString (bt));
					}
				}
				if (tp.HasConstructorConstraint) {
					if (constraints > 0)
						result.Append (",");
					result.Append (Highlight ("new", colorStyle.KeywordOperators));
				}

			}
			return result.ToString ();
		}