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

◆ FromHexString() [1/2]

static byte[] System.Convert.FromHexString ( ReadOnlySpan< char > chars)
inlinestatic

Definition at line 3141 of file Convert.cs.

3142 {
3143 if (chars.Length == 0)
3144 {
3145 return Array.Empty<byte>();
3146 }
3147 if ((uint)chars.Length % 2u != 0)
3148 {
3149 throw new FormatException(SR.Format_BadHexLength);
3150 }
3151 byte[] array = GC.AllocateUninitializedArray<byte>(chars.Length >> 1);
3152 if (!HexConverter.TryDecodeFromUtf16(chars, array))
3153 {
3154 throw new FormatException(SR.Format_BadHexChar);
3155 }
3156 return array;
3157 }

References System.array, System.chars, System.SR.Format_BadHexChar, System.SR.Format_BadHexLength, and System.HexConverter.TryDecodeFromUtf16().