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


C# CSharpOutputVisitor.WriteTypeParameters方法代码示例

本文整理汇总了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));
     }
 }
开发者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

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

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

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


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