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

◆ GetString() [3/4]

unsafe override string System.Text.UTF8Encoding.GetString ( byte[] bytes,
int index,
int count )
inlinevirtualinherited

Reimplemented from System.Text.Encoding.

Definition at line 453 of file UTF8Encoding.cs.

454 {
455 if (bytes == null)
456 {
457 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.bytes, ExceptionResource.ArgumentNull_Array);
458 }
459 if ((index | count) < 0)
460 {
461 ThrowHelper.ThrowArgumentOutOfRangeException((index < 0) ? ExceptionArgument.index : ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
462 }
463 if (bytes.Length - index < count)
464 {
465 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.bytes, ExceptionResource.ArgumentOutOfRange_IndexCountBuffer);
466 }
467 if (count == 0)
468 {
469 return string.Empty;
470 }
471 fixed (byte* ptr = bytes)
472 {
473 return string.CreateStringFromEncoding(ptr + index, count, this);
474 }
475 }

References System.bytes, System.count, System.index, System.ThrowHelper.ThrowArgumentNullException(), and System.ThrowHelper.ThrowArgumentOutOfRangeException().

Referenced by Terraria.IO.FavoritesFile.Load(), and System.Xml.XmlConverter.ToString().