本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.Symbols.ArrayTypeSymbol.InterfacesNoUseSiteDiagnostics方法的典型用法代码示例。如果您正苦于以下问题:C# ArrayTypeSymbol.InterfacesNoUseSiteDiagnostics方法的具体用法?C# ArrayTypeSymbol.InterfacesNoUseSiteDiagnostics怎么用?C# ArrayTypeSymbol.InterfacesNoUseSiteDiagnostics使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.CodeAnalysis.CSharp.Symbols.ArrayTypeSymbol
的用法示例。
在下文中一共展示了ArrayTypeSymbol.InterfacesNoUseSiteDiagnostics方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SubstituteArrayType
private ArrayTypeSymbol SubstituteArrayType(ArrayTypeSymbol t)
{
var oldElement = new TypeWithModifiers(t.ElementType, t.CustomModifiers);
TypeWithModifiers element = oldElement.SubstituteType(this);
if (element == oldElement)
{
return t;
}
ImmutableArray<NamedTypeSymbol> interfaces = t.InterfacesNoUseSiteDiagnostics();
Debug.Assert(0 <= interfaces.Length && interfaces.Length <= 2);
if (interfaces.Length == 1)
{
Debug.Assert(interfaces[0] is NamedTypeSymbol); // IList<T>
interfaces = ImmutableArray.Create<NamedTypeSymbol>((NamedTypeSymbol)SubstituteType(interfaces[0]).AsTypeSymbolOnly());
}
else if (interfaces.Length == 2)
{
Debug.Assert(interfaces[0] is NamedTypeSymbol); // IList<T>
interfaces = ImmutableArray.Create<NamedTypeSymbol>((NamedTypeSymbol)SubstituteType(interfaces[0]).AsTypeSymbolOnly(), (NamedTypeSymbol)SubstituteType(interfaces[1]).AsTypeSymbolOnly());
}
else if (interfaces.Length != 0)
{
throw ExceptionUtilities.Unreachable;
}
return new ArrayTypeSymbol(
element.Type,
t.Rank,
t.BaseTypeNoUseSiteDiagnostics,
interfaces,
element.CustomModifiers);
}
示例2: SubstituteArrayType
private ArrayTypeSymbol SubstituteArrayType(ArrayTypeSymbol t)
{
TypeSymbol element = SubstituteType(t.ElementType);
if (ReferenceEquals(element, t.ElementType))
{
return t;
}
ImmutableArray<NamedTypeSymbol> interfaces = t.InterfacesNoUseSiteDiagnostics();
Debug.Assert(0 <= interfaces.Length && interfaces.Length <= 2);
if (interfaces.Length == 1)
{
Debug.Assert(interfaces[0] is NamedTypeSymbol); // IList<T>
interfaces = ImmutableArray.Create<NamedTypeSymbol>((NamedTypeSymbol)SubstituteType(interfaces[0]));
}
else if (interfaces.Length == 2)
{
Debug.Assert(interfaces[0] is NamedTypeSymbol); // IList<T>
interfaces = ImmutableArray.Create<NamedTypeSymbol>((NamedTypeSymbol)SubstituteType(interfaces[0]), (NamedTypeSymbol)SubstituteType(interfaces[1]));
}
return new ArrayTypeSymbol(
element,
t.Rank,
t.BaseTypeNoUseSiteDiagnostics,
interfaces,
t.CustomModifiers);
}