本文整理汇总了C#中TypeSymbol.GetFullName方法的典型用法代码示例。如果您正苦于以下问题:C# TypeSymbol.GetFullName方法的具体用法?C# TypeSymbol.GetFullName怎么用?C# TypeSymbol.GetFullName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeSymbol
的用法示例。
在下文中一共展示了TypeSymbol.GetFullName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetErrorReportingName
public static string GetErrorReportingName(TypeSymbol type, RefKind refKind = RefKind.None)
{
string prefix = "";
switch (refKind)
{
case RefKind.Ref: prefix = "ref "; break;
case RefKind.Out: prefix = "out "; break;
}
switch (type.GetSpecialTypeSafe())
{
case SpecialType.System_Void:
case SpecialType.System_SByte:
case SpecialType.System_Int16:
case SpecialType.System_Int32:
case SpecialType.System_Int64:
case SpecialType.System_Byte:
case SpecialType.System_UInt16:
case SpecialType.System_UInt32:
case SpecialType.System_UInt64:
case SpecialType.System_Single:
case SpecialType.System_Double:
case SpecialType.System_Decimal:
case SpecialType.System_Char:
case SpecialType.System_Boolean:
case SpecialType.System_String:
case SpecialType.System_Object:
return prefix + SemanticFacts.GetLanguageName(type.SpecialType);
case SpecialType.None:
if (type != null && type.IsNullableType() && !ReferenceEquals(type, type.OriginalDefinition))
{
TypeSymbol underlyingType = type.GetNullableUnderlyingType();
switch (underlyingType.GetSpecialTypeSafe())
{
case SpecialType.System_Boolean:
case SpecialType.System_SByte:
case SpecialType.System_Int16:
case SpecialType.System_Int32:
case SpecialType.System_Int64:
case SpecialType.System_Byte:
case SpecialType.System_UInt16:
case SpecialType.System_UInt32:
case SpecialType.System_UInt64:
case SpecialType.System_Single:
case SpecialType.System_Double:
case SpecialType.System_Decimal:
case SpecialType.System_Char:
return prefix + SemanticFacts.GetLanguageName(underlyingType.SpecialType) + "?";
}
return prefix + GetErrorReportingName(underlyingType) + "?";
}
break;
}
var dynamicType = type as DynamicTypeSymbol;
if (dynamicType != null)
{
return prefix + "dynamic";
}
var arrayType = type as ArrayTypeSymbol;
if (arrayType != null)
{
string suffix = "";
while (true)
{
var elementType = arrayType.ElementType;
suffix += GetSuffix(arrayType.Rank);
arrayType = elementType as ArrayTypeSymbol;
if (arrayType == null)
{
return prefix + GetErrorReportingName(elementType) + suffix;
}
}
}
var pointerType = type as PointerTypeSymbol;
if (pointerType != null)
{
return prefix + GetErrorReportingName(pointerType.BaseType) + "*";
}
var namedType = type as NamedTypeSymbol;
if (namedType != null)
{
string result = "";
if (namedType.ContainingType != null)
{
result = GetErrorReportingName(namedType.ContainingType) + ".";
}
else if (namedType.ContainingNamespace != null && !namedType.ContainingNamespace.IsGlobalNamespace)
{
result = namedType.ContainingNamespace.GetFullName() + ".";
}
result += type.Name;
if (namedType.TypeArguments.Count != 0)
//.........这里部分代码省略.........