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

◆ ToString() [3/3]

static string System.BitConverter.ToString ( byte[] value,
int startIndex,
int length )
inlinestatic

Definition at line 397 of file BitConverter.cs.

398 {
399 if (value == null)
400 {
401 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
402 }
403 if (startIndex < 0 || (startIndex >= value.Length && startIndex > 0))
404 {
405 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
406 }
407 if (length < 0)
408 {
409 throw new ArgumentOutOfRangeException("length", SR.ArgumentOutOfRange_GenericPositive);
410 }
411 if (startIndex > value.Length - length)
412 {
413 ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall, ExceptionArgument.value);
414 }
415 if (length == 0)
416 {
417 return string.Empty;
418 }
419 if (length > 715827882)
420 {
421 throw new ArgumentOutOfRangeException("length", SR.Format(SR.ArgumentOutOfRange_LengthTooLarge, 715827882));
422 }
423 return string.Create(length * 3 - 1, (value, startIndex, length), delegate(Span<char> dst, (byte[] value, int startIndex, int length) state)
424 {
425 ReadOnlySpan<byte> readOnlySpan = new ReadOnlySpan<byte>(state.value, state.startIndex, state.length);
426 int num = 0;
427 int num2 = 0;
428 byte b = readOnlySpan[num++];
429 dst[num2++] = HexConverter.ToCharUpper(b >> 4);
430 dst[num2++] = HexConverter.ToCharUpper(b);
431 while (num < readOnlySpan.Length)
432 {
433 b = readOnlySpan[num++];
434 dst[num2++] = '-';
435 dst[num2++] = HexConverter.ToCharUpper(b >> 4);
436 dst[num2++] = HexConverter.ToCharUpper(b);
437 }
438 });
439 }

References System.SR.ArgumentOutOfRange_GenericPositive, System.SR.ArgumentOutOfRange_LengthTooLarge, System.SR.Format(), System.length, System.ReadOnlySpan< T >.Length, System.startIndex, System.state, System.ThrowHelper.ThrowArgumentException(), System.ThrowHelper.ThrowArgumentNullException(), System.ThrowHelper.ThrowArgumentOutOfRangeException(), System.HexConverter.ToCharUpper(), and System.value.

Referenced by System.Reflection.Metadata.BlobBuilder.Display(), System.Reflection.Internal.MemoryBlock.GetDebuggerDisplay(), System.Runtime.Serialization.Formatters.Binary.SerializationHeaderRecord.Read(), System.Net.Http.HttpConnection.ChunkedEncodingReadStream.ReadChunkFromConnectionBuffer(), System.Net.Security.SafeFreeContextBufferChannelBinding.ToString(), and System.Net.Http.HttpConnection.ChunkedEncodingReadStream.ValidateChunkExtension().