本文整理汇总了C#中IMethodSymbol.ToMinimalDisplayParts方法的典型用法代码示例。如果您正苦于以下问题:C# IMethodSymbol.ToMinimalDisplayParts方法的具体用法?C# IMethodSymbol.ToMinimalDisplayParts怎么用?C# IMethodSymbol.ToMinimalDisplayParts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMethodSymbol
的用法示例。
在下文中一共展示了IMethodSymbol.ToMinimalDisplayParts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMethodGroupPreambleParts
private IEnumerable<SymbolDisplayPart> GetMethodGroupPreambleParts(
IMethodSymbol method,
SemanticModel semanticModel,
int position)
{
var result = new List<SymbolDisplayPart>();
var awaitable = method.GetOriginalUnreducedDefinition().IsAwaitableNonDynamic(semanticModel, position);
var extension = method.GetOriginalUnreducedDefinition().IsExtensionMethod();
if (awaitable && extension)
{
result.Add(Punctuation(SyntaxKind.OpenParenToken));
result.Add(Text(CSharpFeaturesResources.Awaitable));
result.Add(Punctuation(SyntaxKind.CommaToken));
result.Add(Text(CSharpFeaturesResources.Extension));
result.Add(Punctuation(SyntaxKind.CloseParenToken));
result.Add(Space());
}
else if (awaitable)
{
result.Add(Punctuation(SyntaxKind.OpenParenToken));
result.Add(Text(CSharpFeaturesResources.Awaitable));
result.Add(Punctuation(SyntaxKind.CloseParenToken));
result.Add(Space());
}
else if (extension)
{
result.Add(Punctuation(SyntaxKind.OpenParenToken));
result.Add(Text(CSharpFeaturesResources.Extension));
result.Add(Punctuation(SyntaxKind.CloseParenToken));
result.Add(Space());
}
result.AddRange(method.ToMinimalDisplayParts(semanticModel, position, MinimallyQualifiedWithoutParametersFormat));
result.Add(Punctuation(SyntaxKind.OpenParenToken));
return result;
}
示例2: GetMemberDisplayName
private static string GetMemberDisplayName(IMethodSymbol method, int spanStart, SemanticModel semanticModel)
{
var parts = method.ToMinimalDisplayParts(semanticModel, spanStart, SymbolDisplayFormat.CSharpShortErrorMessageFormat)
.SkipWhile(part => !PartKindsToStartWith.Contains(part.Kind))
.ToList();
if (method.MethodKind == MethodKind.EventAdd)
{
parts = parts.Take(parts.Count - 2).ToList();
}
return $"\"{string.Join(string.Empty, parts)}\"";
}