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

◆ Create< TOther >()

static ushort INumber< ushort >. System.UInt16.Create< TOther > ( TOther value)
inlinestatic

Definition at line 435 of file UInt16.cs.

436 {
437 if (typeof(TOther) == typeof(byte))
438 {
439 return (byte)(object)value;
440 }
441 if (typeof(TOther) == typeof(char))
442 {
443 return (char)(object)value;
444 }
445 if (typeof(TOther) == typeof(decimal))
446 {
447 return (ushort)(decimal)(object)value;
448 }
449 checked
450 {
451 if (typeof(TOther) == typeof(double))
452 {
453 return (ushort)(double)(object)value;
454 }
455 if (typeof(TOther) == typeof(short))
456 {
457 return (ushort)(short)(object)value;
458 }
459 if (typeof(TOther) == typeof(int))
460 {
461 return (ushort)(int)(object)value;
462 }
463 if (typeof(TOther) == typeof(long))
464 {
465 return (ushort)(long)(object)value;
466 }
467 if (typeof(TOther) == typeof(IntPtr))
468 {
469 return (ushort)(nint)(IntPtr)(object)value;
470 }
471 if (typeof(TOther) == typeof(sbyte))
472 {
473 return (ushort)(sbyte)(object)value;
474 }
475 if (typeof(TOther) == typeof(float))
476 {
477 return (ushort)(float)(object)value;
478 }
479 if (typeof(TOther) == typeof(ushort))
480 {
481 return (ushort)(object)value;
482 }
483 if (typeof(TOther) == typeof(uint))
484 {
485 return (ushort)(uint)(object)value;
486 }
487 if (typeof(TOther) == typeof(ulong))
488 {
489 return (ushort)(ulong)(object)value;
490 }
491 if (typeof(TOther) == typeof(UIntPtr))
492 {
493 return (ushort)(nuint)(UIntPtr)(object)value;
494 }
495 ThrowHelper.ThrowNotSupportedException();
496 return 0;
497 }
498 }

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