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

◆ ToInt16() [16/19]

static short System.Convert.ToInt16 ( string? value,
int fromBase )
inlinestatic

Definition at line 2544 of file Convert.cs.

2545 {
2546 if (fromBase != 2 && fromBase != 8 && fromBase != 10 && fromBase != 16)
2547 {
2548 throw new ArgumentException(SR.Arg_InvalidBase);
2549 }
2550 if (value == null)
2551 {
2552 return 0;
2553 }
2554 int num = ParseNumbers.StringToInt(value.AsSpan(), fromBase, 6144);
2555 if (fromBase != 10 && num <= 65535)
2556 {
2557 return (short)num;
2558 }
2559 if (num < -32768 || num > 32767)
2560 {
2562 }
2563 return (short)num;
2564 }
static void ThrowInt16OverflowException()
Definition Convert.cs:473

References System.SR.Arg_InvalidBase, System.ParseNumbers.StringToInt(), System.Convert.ThrowInt16OverflowException(), and System.value.