本文整理汇总了C#中Symbol.GetFullName方法的典型用法代码示例。如果您正苦于以下问题:C# Symbol.GetFullName方法的具体用法?C# Symbol.GetFullName怎么用?C# Symbol.GetFullName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symbol
的用法示例。
在下文中一共展示了Symbol.GetFullName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetErrorReportingName
public static object GetErrorReportingName(Symbol symbol)
{
switch (symbol.Kind)
{
case SymbolKind.Assembly:
return GetErrorReportingName(symbol as AssemblySymbol);
case SymbolKind.Namespace:
return GetErrorReportingName(symbol as NamespaceSymbol);
case SymbolKind.Parameter:
return symbol.Name;
case SymbolKind.Local:
return symbol.GetFullName();
case SymbolKind.Field:
return GetErrorReportingName(symbol as FieldSymbol);
case SymbolKind.Method:
return GetErrorReportingName(symbol as MethodSymbol);
case SymbolKind.ArrayType:
case SymbolKind.DynamicType:
case SymbolKind.NamedType:
case SymbolKind.ErrorType:
case SymbolKind.TypeParameter:
case SymbolKind.PointerType:
return GetErrorReportingName(symbol as NamedTypeSymbol);
default:
throw new NotImplementedException();
}
}
示例2: WrongArity
// Check if the given symbol can be accessed with the given arity. If OK, return false.
// If not OK, return true and return a diagnosticinfo. Note that methods with type arguments
// can be accesses with arity zero due to type inference (but non types).
private bool WrongArity(Symbol symbol, int arity, out DiagnosticInfo diagInfo)
{
switch (symbol.Kind) {
case SymbolKind.NamedType:
NamedTypeSymbol namedType = (NamedTypeSymbol)symbol;
if (namedType.Arity != arity) {
diagInfo = new CSDiagnosticInfo(ErrorCode.ERR_BadArity, namedType.GetFullName(), namedType.Arity);
return true;
}
break;
case SymbolKind.Method:
if (arity != 0) {
MethodSymbol method = (MethodSymbol)symbol;
if (method.Arity != arity) {
diagInfo = new CSDiagnosticInfo(ErrorCode.ERR_HasNoTypeVars, method.GetFullName());
return true;
}
}
break;
default:
if (arity != 0) {
diagInfo = new CSDiagnosticInfo(ErrorCode.ERR_TypeArgsNotAllowed, symbol.GetFullName());
return true;
}
break;
}
diagInfo = null;
return false;
}