Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CreateSaturating< TOther >()

static char INumber< char >. System.Char.CreateSaturating< TOther > ( TOther value)
inlinestatic

Definition at line 1048 of file Char.cs.

1049 {
1050 if (typeof(TOther) == typeof(byte))
1051 {
1052 return (char)(byte)(object)value;
1053 }
1054 if (typeof(TOther) == typeof(char))
1055 {
1056 return (char)(object)value;
1057 }
1058 if (typeof(TOther) == typeof(decimal))
1059 {
1060 decimal num = (decimal)(object)value;
1061 if (!(num > 65535m))
1062 {
1063 if (!(num < 0m))
1064 {
1065 return (char)num;
1066 }
1067 return '\0';
1068 }
1069 return '\uffff';
1070 }
1071 if (typeof(TOther) == typeof(double))
1072 {
1073 double num2 = (double)(object)value;
1074 if (!(num2 > 65535.0))
1075 {
1076 if (!(num2 < 0.0))
1077 {
1078 return (char)num2;
1079 }
1080 return '\0';
1081 }
1082 return '\uffff';
1083 }
1084 if (typeof(TOther) == typeof(short))
1085 {
1086 short num3 = (short)(object)value;
1087 if (num3 >= 0)
1088 {
1089 return (char)num3;
1090 }
1091 return '\0';
1092 }
1093 if (typeof(TOther) == typeof(int))
1094 {
1095 int num4 = (int)(object)value;
1096 if (num4 <= 65535)
1097 {
1098 if (num4 >= 0)
1099 {
1100 return (char)num4;
1101 }
1102 return '\0';
1103 }
1104 return '\uffff';
1105 }
1106 if (typeof(TOther) == typeof(long))
1107 {
1108 long num5 = (long)(object)value;
1109 if (num5 <= 65535)
1110 {
1111 if (num5 >= 0)
1112 {
1113 return (char)num5;
1114 }
1115 return '\0';
1116 }
1117 return '\uffff';
1118 }
1119 if (typeof(TOther) == typeof(IntPtr))
1120 {
1121 IntPtr intPtr = (IntPtr)(object)value;
1122 if ((nint)intPtr <= 65535)
1123 {
1124 if ((nint)intPtr >= 0)
1125 {
1126 return (char)(nint)intPtr;
1127 }
1128 return '\0';
1129 }
1130 return '\uffff';
1131 }
1132 if (typeof(TOther) == typeof(sbyte))
1133 {
1134 sbyte b = (sbyte)(object)value;
1135 if (b >= 0)
1136 {
1137 return (char)b;
1138 }
1139 return '\0';
1140 }
1141 if (typeof(TOther) == typeof(float))
1142 {
1143 float num6 = (float)(object)value;
1144 if (!(num6 > 65535f))
1145 {
1146 if (!(num6 < 0f))
1147 {
1148 return (char)num6;
1149 }
1150 return '\0';
1151 }
1152 return '\uffff';
1153 }
1154 if (typeof(TOther) == typeof(ushort))
1155 {
1156 return (char)(ushort)(object)value;
1157 }
1158 if (typeof(TOther) == typeof(uint))
1159 {
1160 uint num7 = (uint)(object)value;
1161 if (num7 <= 65535)
1162 {
1163 return (char)num7;
1164 }
1165 return '\uffff';
1166 }
1167 if (typeof(TOther) == typeof(ulong))
1168 {
1169 ulong num8 = (ulong)(object)value;
1170 if (num8 <= 65535)
1171 {
1172 return (char)num8;
1173 }
1174 return '\uffff';
1175 }
1176 if (typeof(TOther) == typeof(UIntPtr))
1177 {
1178 UIntPtr uIntPtr = (UIntPtr)(object)value;
1179 if ((nuint)uIntPtr <= 65535)
1180 {
1181 return (char)(nuint)uIntPtr;
1182 }
1183 return '\uffff';
1184 }
1185 ThrowHelper.ThrowNotSupportedException();
1186 return '\0';
1187 }

References System.ThrowHelper.ThrowNotSupportedException(), and System.value.