本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol.IsInterfaceType方法的典型用法代码示例。如果您正苦于以下问题:C# NamedTypeSymbol.IsInterfaceType方法的具体用法?C# NamedTypeSymbol.IsInterfaceType怎么用?C# NamedTypeSymbol.IsInterfaceType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.CodeAnalysis.CSharp.Symbols.NamedTypeSymbol
的用法示例。
在下文中一共展示了NamedTypeSymbol.IsInterfaceType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AdjustSymbolsForObjectCreation
private void AdjustSymbolsForObjectCreation(
BoundNode lowestBoundNode,
NamedTypeSymbol typeSymbolOpt,
MethodSymbol constructorOpt,
Binder binderOpt,
ref LookupResultKind resultKind,
ref ImmutableArray<Symbol> symbols,
ref ImmutableArray<Symbol> memberGroup)
{
Debug.Assert(lowestBoundNode != null);
Debug.Assert(binderOpt != null || IsInTree(lowestBoundNode.Syntax));
if ((object)typeSymbolOpt != null)
{
Debug.Assert(lowestBoundNode.Syntax != null);
// Filter typeSymbol's instance constructors by accessibility.
// If all the instance constructors are inaccessible, we retain
// all of them for correct semantic info.
Binder binder = binderOpt ?? GetEnclosingBinder(GetAdjustedNodePosition(lowestBoundNode.Syntax));
ImmutableArray<MethodSymbol> candidateConstructors;
if (binder != null)
{
var instanceConstructors = typeSymbolOpt.IsInterfaceType() && (object)typeSymbolOpt.ComImportCoClass != null ?
typeSymbolOpt.ComImportCoClass.InstanceConstructors :
typeSymbolOpt.InstanceConstructors;
HashSet<DiagnosticInfo> useSiteDiagnostics = null;
candidateConstructors = binder.FilterInaccessibleConstructors(instanceConstructors, allowProtectedConstructorsOfBaseType: false, useSiteDiagnostics: ref useSiteDiagnostics);
if ((object)constructorOpt == null ? !candidateConstructors.Any() : !candidateConstructors.Contains(constructorOpt))
{
// All instance constructors are inaccessible or if the specified constructor
// isn't a candidate, then we retain all of them for correct semantic info.
Debug.Assert(resultKind != LookupResultKind.Viable);
candidateConstructors = instanceConstructors;
}
}
else
{
candidateConstructors = ImmutableArray<MethodSymbol>.Empty;
}
if ((object)constructorOpt != null)
{
Debug.Assert(candidateConstructors.Contains(constructorOpt));
symbols = ImmutableArray.Create<Symbol>(constructorOpt);
}
else if (candidateConstructors.Length > 0)
{
symbols = StaticCast<Symbol>.From(candidateConstructors);
Debug.Assert(resultKind != LookupResultKind.Viable);
resultKind = resultKind.WorseResultKind(LookupResultKind.OverloadResolutionFailure);
}
memberGroup = candidateConstructors.Cast<MethodSymbol, Symbol>();
}
}