Пример #1
0
Файл: CSEX.cs Проект: knat/SData
 internal static bool IsAtomType(TypeKind typeKind, ITypeSymbol typeSymbol)
 {
     switch (typeKind)
     {
         case TypeKind.String:
             return typeSymbol.SpecialType == SpecialType.System_String;
         case TypeKind.IgnoreCaseString:
             return typeSymbol.FullNameEquals(IgnoreCaseStringNameParts);
         case TypeKind.Char:
             return typeSymbol.SpecialType == SpecialType.System_Char;
         case TypeKind.Decimal:
             return typeSymbol.SpecialType == SpecialType.System_Decimal;
         case TypeKind.Int64:
             return typeSymbol.SpecialType == SpecialType.System_Int64;
         case TypeKind.Int32:
             return typeSymbol.SpecialType == SpecialType.System_Int32;
         case TypeKind.Int16:
             return typeSymbol.SpecialType == SpecialType.System_Int16;
         case TypeKind.SByte:
             return typeSymbol.SpecialType == SpecialType.System_SByte;
         case TypeKind.UInt64:
             return typeSymbol.SpecialType == SpecialType.System_UInt64;
         case TypeKind.UInt32:
             return typeSymbol.SpecialType == SpecialType.System_UInt32;
         case TypeKind.UInt16:
             return typeSymbol.SpecialType == SpecialType.System_UInt16;
         case TypeKind.Byte:
             return typeSymbol.SpecialType == SpecialType.System_Byte;
         case TypeKind.Double:
             return typeSymbol.SpecialType == SpecialType.System_Double;
         case TypeKind.Single:
             return typeSymbol.SpecialType == SpecialType.System_Single;
         case TypeKind.Boolean:
             return typeSymbol.SpecialType == SpecialType.System_Boolean;
         case TypeKind.Binary:
             return typeSymbol.FullNameEquals(BinaryNameParts);
         case TypeKind.Guid:
             return typeSymbol.FullNameEquals(CS.GuidNameParts);
         case TypeKind.TimeSpan:
             return typeSymbol.FullNameEquals(CS.TimeSpanNameParts);
         case TypeKind.DateTimeOffset:
             return typeSymbol.FullNameEquals(CS.DateTimeOffsetNameParts);
         default:
             throw new ArgumentException("Invalid type kind: " + typeKind.ToString());
     }
 }