本文整理汇总了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);
}
示例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);
}
示例4: IsReachable
bool IsReachable (SemanticModel model, ITypeSymbol type, SyntaxNode node)
{
return type.ToMinimalDisplayString (model, node.SpanStart).IndexOf ('.') < 0;
}
示例5: ConvertType
public static TypeSyntax ConvertType(SemanticModel model, int position, ITypeSymbol type)
{
return SyntaxFactory.ParseTypeName(type.ToMinimalDisplayString(model, position));
}