本文整理汇总了C#中ISymbol.IsStaticConstructor方法的典型用法代码示例。如果您正苦于以下问题:C# ISymbol.IsStaticConstructor方法的具体用法?C# ISymbol.IsStaticConstructor怎么用?C# ISymbol.IsStaticConstructor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISymbol
的用法示例。
在下文中一共展示了ISymbol.IsStaticConstructor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SymbolLocationNavigableItem
public SymbolLocationNavigableItem(
Solution solution,
ISymbol symbol,
Location location)
{
_solution = solution;
_symbol = symbol;
_location = location;
_lazyDisplayName = new Lazy<string>(() =>
{
var symbolDisplayService = this.Document.Project.LanguageServices.GetService<ISymbolDisplayService>();
switch (symbol.Kind)
{
case SymbolKind.NamedType:
return symbolDisplayService.ToDisplayString(_symbol, s_shortFormatWithModifiers);
case SymbolKind.Method:
return _symbol.IsStaticConstructor()
? symbolDisplayService.ToDisplayString(_symbol, s_shortFormatWithModifiers)
: symbolDisplayService.ToDisplayString(_symbol, s_shortFormat);
default:
return symbolDisplayService.ToDisplayString(_symbol, s_shortFormat);
}
});
}
示例2: GetSymbolDisplayFormat
private static SymbolDisplayFormat GetSymbolDisplayFormat(ISymbol symbol)
{
switch (symbol.Kind)
{
case SymbolKind.NamedType:
return s_shortFormatWithModifiers;
case SymbolKind.Method:
return symbol.IsStaticConstructor() ? s_shortFormatWithModifiers : s_shortFormat;
default:
return s_shortFormat;
}
}
示例3: GetSymbolDisplayString
public static string GetSymbolDisplayString(Project project, ISymbol symbol)
{
var symbolDisplayService = project.LanguageServices.GetRequiredService<ISymbolDisplayService>();
switch (symbol.Kind)
{
case SymbolKind.NamedType:
return symbolDisplayService.ToDisplayString(symbol, s_shortFormatWithModifiers);
case SymbolKind.Method:
return symbol.IsStaticConstructor()
? symbolDisplayService.ToDisplayString(symbol, s_shortFormatWithModifiers)
: symbolDisplayService.ToDisplayString(symbol, s_shortFormat);
default:
return symbolDisplayService.ToDisplayString(symbol, s_shortFormat);
}
}
示例4: GetSearchName
private static string GetSearchName(ISymbol symbol)
{
if (symbol.IsConstructor() || symbol.IsStaticConstructor())
{
return symbol.ContainingType.Name;
}
else if (symbol.IsIndexer() && symbol.Name == WellKnownMemberNames.Indexer)
{
return "this";
}
return symbol.Name;
}