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


C# ITypeSymbol.ToMinimalDisplayString方法代码示例

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


在下文中一共展示了ITypeSymbol.ToMinimalDisplayString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PerformAction

 static Document PerformAction(Document document, SemanticModel model, SyntaxNode root, ITypeSymbol type, TypeSyntax typeSyntax)
 {
     var newRoot = root.ReplaceNode((SyntaxNode)
         typeSyntax,
         SyntaxFactory.ParseTypeName(type.ToMinimalDisplayString(model, typeSyntax.SpanStart))
         .WithLeadingTrivia(typeSyntax.GetLeadingTrivia())
         .WithTrailingTrivia(typeSyntax.GetTrailingTrivia())
     );
     return document.WithSyntaxRoot(newRoot);
 }
开发者ID:alecor191,项目名称:RefactoringEssentials,代码行数:10,代码来源:ReplaceVarWithExplicitTypeCodeRefactoringProvider.cs

示例2: GetNewAttributeList

        private static AttributeListSyntax GetNewAttributeList(AttributeListSyntax attributeList, ITypeSymbol optionalAttribute,
            SemanticModel semanticModel)
        {
            var attributeName = optionalAttribute.ToMinimalDisplayString(semanticModel, attributeList.SpanStart);
            attributeName = attributeName.Remove(attributeName.IndexOf("Attribute", System.StringComparison.Ordinal));

            return attributeList.AddAttributes(
                SyntaxFactory.Attribute(
                    SyntaxFactory.ParseName(attributeName)))
                    .WithAdditionalAnnotations(Formatter.Annotation);
        }
开发者ID:dbolkensteyn,项目名称:sonarlint-vs,代码行数:11,代码来源:MethodParameterMissingOptionalCodeFixProvider.cs

示例3: InsertIntoBaseList

        private static TypeDeclarationSyntax InsertIntoBaseList(TypeDeclarationSyntax typeDeclaration, ITypeSymbol typeSymbol, SemanticModel semanticModel, int insertionIndex)
        {
            var position = typeDeclaration.SpanStart;
            var identifier = typeDeclaration.Identifier;
            if (identifier.HasTrailingTrivia)
            {
                typeDeclaration = typeDeclaration.WithIdentifier(
                    identifier.WithTrailingTrivia(identifier.TrailingTrivia.SkipWhile(t => t.IsWhitespaceOrEndOfLine())));
            }

            var typeName = SyntaxFactory.ParseTypeName(typeSymbol.ToMinimalDisplayString(semanticModel, position));
            var baseList = typeDeclaration.BaseList != null
                ? typeDeclaration.BaseList.WithTypes(typeDeclaration.BaseList.Types.Insert(insertionIndex, SyntaxFactory.SimpleBaseType(typeName)))
                : SyntaxFactory.BaseList(SyntaxFactory.SingletonSeparatedList((BaseTypeSyntax)SyntaxFactory.SimpleBaseType(typeName)));

            return typeDeclaration.WithBaseList(baseList);
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:17,代码来源:CSharpCodeModelService.cs

示例4: IsReachable

		bool IsReachable (SemanticModel model, ITypeSymbol type, SyntaxNode node)
		{
			return type.ToMinimalDisplayString (model, node.SpanStart).IndexOf ('.') < 0;
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:4,代码来源:EnumMemberContextHandler.cs

示例5: ConvertType

 public static TypeSyntax ConvertType(SemanticModel model, int position, ITypeSymbol type)
 {
     return SyntaxFactory.ParseTypeName(type.ToMinimalDisplayString(model, position));
 }
开发者ID:alecor191,项目名称:RefactoringEssentials,代码行数:4,代码来源:RefactoringHelpers.cs


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