本文整理汇总了C#中ICSharpCode.NRefactory.CSharp.CSharpOutputVisitor.WriteTypeParameters方法的典型用法代码示例。如果您正苦于以下问题:C# CSharpOutputVisitor.WriteTypeParameters方法的具体用法?C# CSharpOutputVisitor.WriteTypeParameters怎么用?C# CSharpOutputVisitor.WriteTypeParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.NRefactory.CSharp.CSharpOutputVisitor
的用法示例。
在下文中一共展示了CSharpOutputVisitor.WriteTypeParameters方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteTypeDeclarationName
void WriteTypeDeclarationName(ITypeDefinition typeDef, IOutputFormatter formatter, CSharpFormattingOptions formattingPolicy)
{
TypeSystemAstBuilder astBuilder = CreateAstBuilder();
if (typeDef.DeclaringTypeDefinition != null) {
WriteTypeDeclarationName(typeDef.DeclaringTypeDefinition, formatter, formattingPolicy);
formatter.WriteToken(".");
} else if ((ConversionFlags & ConversionFlags.UseFullyQualifiedTypeNames) == ConversionFlags.UseFullyQualifiedTypeNames) {
formatter.WriteIdentifier(typeDef.Namespace);
formatter.WriteToken(".");
}
formatter.WriteIdentifier(typeDef.Name);
if ((ConversionFlags & ConversionFlags.ShowTypeParameterList) == ConversionFlags.ShowTypeParameterList) {
var outputVisitor = new CSharpOutputVisitor(formatter, formattingPolicy);
outputVisitor.WriteTypeParameters(astBuilder.ConvertEntity(typeDef).GetChildrenByRole(Roles.TypeParameter));
}
}
示例2: WriteMemberDeclarationName
void WriteMemberDeclarationName(IMember member, IOutputFormatter formatter, CSharpFormattingOptions formattingPolicy)
{
TypeSystemAstBuilder astBuilder = CreateAstBuilder();
if ((ConversionFlags & ConversionFlags.ShowDeclaringType) == ConversionFlags.ShowDeclaringType) {
ConvertType(member.DeclaringType, formatter, formattingPolicy);
formatter.WriteToken(".");
}
switch (member.EntityType) {
case EntityType.Indexer:
formatter.WriteKeyword("this");
break;
case EntityType.Constructor:
formatter.WriteIdentifier(member.DeclaringType.Name);
break;
case EntityType.Destructor:
formatter.WriteToken("~");
formatter.WriteIdentifier(member.DeclaringType.Name);
break;
case EntityType.Operator:
switch (member.Name) {
case "op_Implicit":
formatter.WriteKeyword("implicit");
formatter.Space();
formatter.WriteKeyword("operator");
formatter.Space();
ConvertType(member.ReturnType, formatter, formattingPolicy);
break;
case "op_Explicit":
formatter.WriteKeyword("explicit");
formatter.Space();
formatter.WriteKeyword("operator");
formatter.Space();
ConvertType(member.ReturnType, formatter, formattingPolicy);
break;
default:
formatter.WriteKeyword("operator");
formatter.Space();
var operatorType = OperatorDeclaration.GetOperatorType(member.Name);
if (operatorType.HasValue)
formatter.WriteToken(OperatorDeclaration.GetToken(operatorType.Value));
else
formatter.WriteIdentifier(member.Name);
break;
}
break;
default:
formatter.WriteIdentifier(member.Name);
break;
}
if ((ConversionFlags & ConversionFlags.ShowTypeParameterList) == ConversionFlags.ShowTypeParameterList && member.EntityType == EntityType.Method) {
var outputVisitor = new CSharpOutputVisitor(formatter, formattingPolicy);
outputVisitor.WriteTypeParameters(astBuilder.ConvertEntity(member).GetChildrenByRole(Roles.TypeParameter));
}
}
示例3: WriteTypeDeclarationName
void WriteTypeDeclarationName(ITypeDefinition typeDef, TokenWriter writer, CSharpFormattingOptions formattingPolicy)
{
TypeSystemAstBuilder astBuilder = CreateAstBuilder();
EntityDeclaration node = astBuilder.ConvertEntity(typeDef);
if (typeDef.DeclaringTypeDefinition != null) {
WriteTypeDeclarationName(typeDef.DeclaringTypeDefinition, writer, formattingPolicy);
writer.WriteToken(Roles.Dot, ".");
} else if ((ConversionFlags & ConversionFlags.UseFullyQualifiedTypeNames) == ConversionFlags.UseFullyQualifiedTypeNames) {
WriteQualifiedName(typeDef.Namespace, writer, formattingPolicy);
writer.WriteToken(Roles.Dot, ".");
}
writer.WriteIdentifier(node.NameToken);
if ((ConversionFlags & ConversionFlags.ShowTypeParameterList) == ConversionFlags.ShowTypeParameterList) {
var outputVisitor = new CSharpOutputVisitor(writer, formattingPolicy);
outputVisitor.WriteTypeParameters(node.GetChildrenByRole(Roles.TypeParameter));
}
}
示例4: WriteMemberDeclarationName
void WriteMemberDeclarationName(IMember member, TokenWriter writer, CSharpFormattingOptions formattingPolicy)
{
TypeSystemAstBuilder astBuilder = CreateAstBuilder();
EntityDeclaration node = astBuilder.ConvertEntity(member);
if ((ConversionFlags & ConversionFlags.ShowDeclaringType) == ConversionFlags.ShowDeclaringType) {
ConvertType(member.DeclaringType, writer, formattingPolicy);
writer.WriteToken(Roles.Dot, ".");
}
switch (member.SymbolKind) {
case SymbolKind.Indexer:
writer.WriteKeyword(Roles.Identifier, "this");
break;
case SymbolKind.Constructor:
WriteQualifiedName(member.DeclaringType.Name, writer, formattingPolicy);
break;
case SymbolKind.Destructor:
writer.WriteToken(DestructorDeclaration.TildeRole, "~");
WriteQualifiedName(member.DeclaringType.Name, writer, formattingPolicy);
break;
case SymbolKind.Operator:
switch (member.Name) {
case "op_Implicit":
writer.WriteKeyword(OperatorDeclaration.ImplicitRole, "implicit");
writer.Space();
writer.WriteKeyword(OperatorDeclaration.OperatorKeywordRole, "operator");
writer.Space();
ConvertType(member.ReturnType, writer, formattingPolicy);
break;
case "op_Explicit":
writer.WriteKeyword(OperatorDeclaration.ExplicitRole, "explicit");
writer.Space();
writer.WriteKeyword(OperatorDeclaration.OperatorKeywordRole, "operator");
writer.Space();
ConvertType(member.ReturnType, writer, formattingPolicy);
break;
default:
writer.WriteKeyword(OperatorDeclaration.OperatorKeywordRole, "operator");
writer.Space();
var operatorType = OperatorDeclaration.GetOperatorType(member.Name);
if (operatorType.HasValue)
writer.WriteToken(OperatorDeclaration.GetRole(operatorType.Value), OperatorDeclaration.GetToken(operatorType.Value));
else
writer.WriteIdentifier(node.NameToken);
break;
}
break;
default:
writer.WriteIdentifier(Identifier.Create(member.Name));
break;
}
if ((ConversionFlags & ConversionFlags.ShowTypeParameterList) == ConversionFlags.ShowTypeParameterList && member.SymbolKind == SymbolKind.Method) {
var outputVisitor = new CSharpOutputVisitor(writer, formattingPolicy);
outputVisitor.WriteTypeParameters(node.GetChildrenByRole(Roles.TypeParameter));
}
}
示例5: WriteTypeDeclarationName
void WriteTypeDeclarationName(ITypeDefinition typeDef, TokenWriter writer, CSharpFormattingOptions formattingPolicy)
{
TypeSystemAstBuilder astBuilder = CreateAstBuilder();
EntityDeclaration node = astBuilder.ConvertEntity(typeDef);
if (typeDef.DeclaringTypeDefinition != null) {
WriteTypeDeclarationName(typeDef.DeclaringTypeDefinition, writer, formattingPolicy);
writer.WriteTokenOperator(Roles.Dot, ".");
} else if ((ConversionFlags & ConversionFlags.UseFullyQualifiedEntityNames) == ConversionFlags.UseFullyQualifiedEntityNames) {
if (!string.IsNullOrEmpty(typeDef.Namespace)) {
WriteQualifiedName(typeDef.Namespace, writer, formattingPolicy);
writer.WriteTokenOperator(Roles.Dot, ".");
}
}
writer.WriteIdentifier(node.NameToken, BoxedTextColor.Text);
if ((ConversionFlags & ConversionFlags.ShowTypeParameterList) == ConversionFlags.ShowTypeParameterList) {
var outputVisitor = new CSharpOutputVisitor(writer, formattingPolicy);
outputVisitor.WriteTypeParameters(node.GetChildrenByRole(Roles.TypeParameter), CodeBracesRangeFlags.AngleBrackets);
}
}