本文整理汇总了C#中Symbol.GetMemberArity方法的典型用法代码示例。如果您正苦于以下问题:C# Symbol.GetMemberArity方法的具体用法?C# Symbol.GetMemberArity怎么用?C# Symbol.GetMemberArity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symbol
的用法示例。
在下文中一共展示了Symbol.GetMemberArity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckNewModifier
private void CheckNewModifier(Symbol symbol, bool isNew, DiagnosticBag diagnostics)
{
// for error cases
if ((object)this.BaseTypeNoUseSiteDiagnostics == null)
{
return;
}
// Do not give warnings about missing 'new' modifier for implicitly declared members,
// e.g. backing fields for auto-properties
if (symbol.IsImplicitlyDeclared)
{
return;
}
int symbolArity = symbol.GetMemberArity();
Location symbolLocation = symbol.Locations.FirstOrDefault();
bool unused = false;
NamedTypeSymbol currType = this.BaseTypeNoUseSiteDiagnostics;
while ((object)currType != null)
{
foreach (var hiddenMember in currType.GetMembers(symbol.Name))
{
if (hiddenMember.Kind == SymbolKind.Method && !((MethodSymbol)hiddenMember).CanBeHiddenByMemberKind(symbol.Kind))
{
continue;
}
HashSet<DiagnosticInfo> useSiteDiagnostics = null;
bool isAccessible = AccessCheck.IsSymbolAccessible(hiddenMember, this, ref useSiteDiagnostics);
diagnostics.Add(symbolLocation, useSiteDiagnostics);
if (isAccessible && hiddenMember.GetMemberArity() == symbolArity)
{
if (!isNew)
{
diagnostics.Add(ErrorCode.WRN_NewRequired, symbolLocation, symbol, hiddenMember);
}
AddHidingAbstractDiagnostic(symbol, symbolLocation, hiddenMember, diagnostics, ref unused);
return;
}
}
currType = currType.BaseTypeNoUseSiteDiagnostics;
}
if (isNew)
{
diagnostics.Add(ErrorCode.WRN_NewNotRequired, symbolLocation, symbol);
}
}