本文整理汇总了C#中ISymbol.MatchesKind方法的典型用法代码示例。如果您正苦于以下问题:C# ISymbol.MatchesKind方法的具体用法?C# ISymbol.MatchesKind怎么用?C# ISymbol.MatchesKind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISymbol
的用法示例。
在下文中一共展示了ISymbol.MatchesKind方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ComputeSymbolMatchPriority
private static int ComputeSymbolMatchPriority(ISymbol symbol)
{
if (symbol.MatchesKind(SymbolKind.Local, SymbolKind.Parameter, SymbolKind.RangeVariable))
{
return SymbolMatchPriority.PreferLocalOrParameterOrRangeVariable;
}
if (symbol.MatchesKind(SymbolKind.Field, SymbolKind.Property))
{
return SymbolMatchPriority.PreferFieldOrProperty;
}
if (symbol.MatchesKind(SymbolKind.Event, SymbolKind.Method))
{
return SymbolMatchPriority.PreferEventOrMethod;
}
return SymbolMatchPriority.PreferType;
}
示例2: IsInitializable
static bool IsInitializable (ISymbol member, INamedTypeSymbol containingType)
{
var propertySymbol = member as IPropertySymbol;
if (propertySymbol != null) {
if (propertySymbol.Parameters.Any (p => !p.IsOptional))
return false;
}
return
!member.IsStatic &&
member.MatchesKind (SymbolKind.Field, SymbolKind.Property) &&
member.IsAccessibleWithin (containingType);
}
示例3: IsInitializable
protected virtual bool IsInitializable(ISymbol member, INamedTypeSymbol containingType)
{
return
!member.IsStatic &&
member.MatchesKind(SymbolKind.Field, SymbolKind.Property) &&
member.IsAccessibleWithin(containingType);
}
示例4: Format
private string Format(ISymbol symbol)
{
if (symbol is ITypeSymbol || symbol is INamespaceSymbol)
{
return FormatTypeOrNamespace((INamespaceOrTypeSymbol)symbol);
}
if (symbol.MatchesKind(SymbolKind.Alias, SymbolKind.Local, SymbolKind.Parameter))
{
return Format(symbol.GetSymbolType());
}
var containingType = FormatTypeOrNamespace(symbol.ContainingType);
var name = symbol.ToDisplayString(NameFormat);
if (symbol.IsConstructor())
{
return string.Format("{0}.#ctor", containingType);
}
if (symbol.GetTypeArguments().Any())
{
return string.Format("{0}.{1}``{2}", containingType, name, symbol.GetTypeArguments().Length);
}
return string.Format("{0}.{1}", containingType, name);
}
示例5: FormatSymbol
public override string FormatSymbol(ISymbol symbol)
{
if (symbol is ITypeSymbol || symbol is INamespaceSymbol)
{
return FormatNamespaceOrTypeSymbol((INamespaceOrTypeSymbol)symbol);
}
if (symbol.MatchesKind(SymbolKind.Alias, SymbolKind.Local, SymbolKind.Parameter))
{
return FormatSymbol(symbol.GetSymbolType());
}
var containingType = FormatNamespaceOrTypeSymbol(symbol.ContainingType);
var name = symbol.ToDisplayString(NameFormat);
if (symbol.IsConstructor())
{
return $"{containingType}.#ctor";
}
if (symbol.GetTypeArguments().Any())
{
return $"{containingType}.{name}``{symbol.GetTypeArguments().Length}";
}
return $"{containingType}.{name}";
}