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

◆ ToByte() [16/19]

static byte System.Convert.ToByte ( string? value,
int fromBase )
inlinestatic

Definition at line 2503 of file Convert.cs.

2504 {
2505 if (fromBase != 2 && fromBase != 8 && fromBase != 10 && fromBase != 16)
2506 {
2507 throw new ArgumentException(SR.Arg_InvalidBase);
2508 }
2509 if (value == null)
2510 {
2511 return 0;
2512 }
2513 int num = ParseNumbers.StringToInt(value.AsSpan(), fromBase, 4608);
2514 if ((uint)num > 255u)
2515 {
2517 }
2518 return (byte)num;
2519 }
static void ThrowByteOverflowException()
Definition Convert.cs:461

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