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

◆ ToSByte() [16/19]

static sbyte System.Convert.ToSByte ( string? value,
int fromBase )
inlinestatic

Definition at line 2522 of file Convert.cs.

2523 {
2524 if (fromBase != 2 && fromBase != 8 && fromBase != 10 && fromBase != 16)
2525 {
2526 throw new ArgumentException(SR.Arg_InvalidBase);
2527 }
2528 if (value == null)
2529 {
2530 return 0;
2531 }
2532 int num = ParseNumbers.StringToInt(value.AsSpan(), fromBase, 5120);
2533 if (fromBase != 10 && num <= 255)
2534 {
2535 return (sbyte)num;
2536 }
2537 if (num < -128 || num > 127)
2538 {
2540 }
2541 return (sbyte)num;
2542 }
static void ThrowSByteOverflowException()
Definition Convert.cs:467

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