本文整理汇总了C#中MultiDictionary.TryGetMultipleValues方法的典型用法代码示例。如果您正苦于以下问题:C# MultiDictionary.TryGetMultipleValues方法的具体用法?C# MultiDictionary.TryGetMultipleValues怎么用?C# MultiDictionary.TryGetMultipleValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MultiDictionary
的用法示例。
在下文中一共展示了MultiDictionary.TryGetMultipleValues方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckMemberDistinctness
private void CheckMemberDistinctness(NamespaceOrTypeSymbol symbol)
{
System.Diagnostics.Debug.Assert(IsAccessibleOutsideAssembly(symbol));
System.Diagnostics.Debug.Assert(IsTrue(GetDeclaredOrInheritedCompliance(symbol)));
MultiDictionary<string, Symbol> seenByName = new MultiDictionary<string, Symbol>(CaseInsensitiveComparison.Comparer);
// For types, we also need to consider collisions with inherited members.
if (symbol.Kind != SymbolKind.Namespace)
{
NamedTypeSymbol type = (NamedTypeSymbol)symbol;
// NOTE: As in dev11 we're using Interfaces, rather than AllInterfaces.
// This seems like a bug, but it's easier to reproduce it than to deal
// with all the potential breaks.
// NOTE: It's not clear why dev11 is looking in interfaces at all. Maybe
// it was only supposed to happen for interface types?
foreach (NamedTypeSymbol @interface in type.InterfacesAndTheirBaseInterfacesNoUseSiteDiagnostics) // NOTE: would be handrolled in a standalone component.
{
if (!IsAccessibleOutsideAssembly(@interface)) continue;
foreach (Symbol member in @interface.GetMembersUnordered())
{
// NOTE: As in dev11 we filter out overriding methods and properties (but not events).
// NOTE: As in dev11, we ignore the CLS compliance of the interface and its members.
if (IsAccessibleIfContainerIsAccessible(member) &&
(!member.IsOverride || !(member.Kind == SymbolKind.Method || member.Kind == SymbolKind.Property)))
{
seenByName.Add(member.Name, member);
}
}
}
NamedTypeSymbol baseType = type.BaseTypeNoUseSiteDiagnostics;
while ((object)baseType != null)
{
foreach (Symbol member in baseType.GetMembersUnordered())
{
// NOTE: As in dev11 we filter out overriding methods and properties (but not events).
// NOTE: Unlike for interface members, we check CLS compliance of base type members.
if (IsAccessibleOutsideAssembly(member) &&
IsTrue(GetDeclaredOrInheritedCompliance(member)) &&
(!member.IsOverride || !(member.Kind == SymbolKind.Method || member.Kind == SymbolKind.Property)))
{
seenByName.Add(member.Name, member);
}
}
baseType = baseType.BaseTypeNoUseSiteDiagnostics;
}
}
// NOTE: visit the members in order so that the same one is always reported as a conflict.
foreach (Symbol member in symbol.GetMembers())
{
// Filter out uninteresting members:
if (DoNotVisit(member) ||
!IsAccessibleIfContainerIsAccessible(member) || // We already know that the container is accessible.
!IsTrue(GetDeclaredOrInheritedCompliance(member)) ||
member.IsOverride)
{
continue;
}
string name = member.Name;
IEnumerable<Symbol> sameNameSymbols;
if (seenByName.TryGetMultipleValues(name, out sameNameSymbols))
{
CheckSymbolDistinctness(member, sameNameSymbols);
}
seenByName.Add(name, member);
}
}