Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
TypeExtensionMethods.cs
Go to the documentation of this file.
2
3internal static class TypeExtensionMethods
4{
5 public static TypeCode GetTypeCode(this Type type)
6 {
7 if (type == null)
8 {
9 return TypeCode.Empty;
10 }
11 if (type == typeof(bool))
12 {
13 return TypeCode.Boolean;
14 }
15 if (type == typeof(char))
16 {
17 return TypeCode.Char;
18 }
19 if (type == typeof(sbyte))
20 {
21 return TypeCode.SByte;
22 }
23 if (type == typeof(byte))
24 {
25 return TypeCode.Byte;
26 }
27 if (type == typeof(short))
28 {
29 return TypeCode.Int16;
30 }
31 if (type == typeof(ushort))
32 {
33 return TypeCode.UInt16;
34 }
35 if (type == typeof(int))
36 {
37 return TypeCode.Int32;
38 }
39 if (type == typeof(uint))
40 {
41 return TypeCode.UInt32;
42 }
43 if (type == typeof(long))
44 {
45 return TypeCode.Int64;
46 }
47 if (type == typeof(ulong))
48 {
49 return TypeCode.UInt64;
50 }
51 if (type == typeof(float))
52 {
53 return TypeCode.Single;
54 }
55 if (type == typeof(double))
56 {
57 return TypeCode.Double;
58 }
59 if (type == typeof(decimal))
60 {
61 return TypeCode.Decimal;
62 }
63 if (type == typeof(DateTime))
64 {
65 return TypeCode.DateTime;
66 }
67 if (type == typeof(string))
68 {
69 return TypeCode.String;
70 }
71 return TypeCode.Object;
72 }
73}
TypeCode
Definition TypeCode.cs:4