当前位置: 首页>>代码示例>>C#>>正文


C# IOutputFormatter.WriteIdentifier方法代码示例

本文整理汇总了C#中IOutputFormatter.WriteIdentifier方法的典型用法代码示例。如果您正苦于以下问题:C# IOutputFormatter.WriteIdentifier方法的具体用法?C# IOutputFormatter.WriteIdentifier怎么用?C# IOutputFormatter.WriteIdentifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IOutputFormatter的用法示例。


在下文中一共展示了IOutputFormatter.WriteIdentifier方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
     }
 }
开发者ID:segaman,项目名称:NRefactory,代码行数:16,代码来源:CSharpAmbience.cs

示例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));
     }
 }
开发者ID:segaman,项目名称:NRefactory,代码行数:54,代码来源:CSharpAmbience.cs


注:本文中的IOutputFormatter.WriteIdentifier方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。