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

◆ TryCreate< TOther >() [1/2]

static bool INumber< Half >. System.Half.TryCreate< TOther > ( TOther value,
out Half result )
inlinestatic

Definition at line 1277 of file Half.cs.

1278 {
1279 if (typeof(TOther) == typeof(byte))
1280 {
1281 result = (Half)(int)(byte)(object)value;
1282 return true;
1283 }
1284 if (typeof(TOther) == typeof(char))
1285 {
1286 result = (Half)(int)(char)(object)value;
1287 return true;
1288 }
1289 if (typeof(TOther) == typeof(decimal))
1290 {
1291 result = (Half)(float)(decimal)(object)value;
1292 return true;
1293 }
1294 if (typeof(TOther) == typeof(double))
1295 {
1296 result = (Half)(double)(object)value;
1297 return true;
1298 }
1299 if (typeof(TOther) == typeof(short))
1300 {
1301 result = (Half)(short)(object)value;
1302 return true;
1303 }
1304 if (typeof(TOther) == typeof(int))
1305 {
1306 result = (Half)(int)(object)value;
1307 return true;
1308 }
1309 if (typeof(TOther) == typeof(long))
1310 {
1311 result = (Half)(long)(object)value;
1312 return true;
1313 }
1314 if (typeof(TOther) == typeof(IntPtr))
1315 {
1316 result = (Half)(nint)(IntPtr)(object)value;
1317 return true;
1318 }
1319 if (typeof(TOther) == typeof(sbyte))
1320 {
1321 result = (Half)(sbyte)(object)value;
1322 return true;
1323 }
1324 if (typeof(TOther) == typeof(float))
1325 {
1326 result = (Half)(float)(object)value;
1327 return true;
1328 }
1329 if (typeof(TOther) == typeof(ushort))
1330 {
1331 result = (Half)(int)(ushort)(object)value;
1332 return true;
1333 }
1334 if (typeof(TOther) == typeof(uint))
1335 {
1336 result = (Half)(uint)(object)value;
1337 return true;
1338 }
1339 if (typeof(TOther) == typeof(ulong))
1340 {
1341 result = (Half)(ulong)(object)value;
1342 return true;
1343 }
1344 if (typeof(TOther) == typeof(UIntPtr))
1345 {
1346 result = (Half)(nuint)(UIntPtr)(object)value;
1347 return true;
1348 }
1349 ThrowHelper.ThrowNotSupportedException();
1350 result = default(Half);
1351 return false;
1352 }
Half(ushort value)
Definition Half.cs:78

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