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

◆ StringBuilder() [5/9]

System.Text.StringBuilder.StringBuilder ( string? value,
int startIndex,
int length,
int capacity )
inline

Definition at line 550 of file StringBuilder.cs.

551 {
552 if (capacity < 0)
553 {
554 throw new ArgumentOutOfRangeException("capacity", SR.Format(SR.ArgumentOutOfRange_MustBePositive, "capacity"));
555 }
556 if (length < 0)
557 {
558 throw new ArgumentOutOfRangeException("length", SR.Format(SR.ArgumentOutOfRange_MustBeNonNegNum, "length"));
559 }
560 if (startIndex < 0)
561 {
562 throw new ArgumentOutOfRangeException("startIndex", SR.ArgumentOutOfRange_StartIndex);
563 }
564 if (value == null)
565 {
566 value = string.Empty;
567 }
568 if (startIndex > value.Length - length)
569 {
570 throw new ArgumentOutOfRangeException("length", SR.ArgumentOutOfRange_IndexLength);
571 }
572 m_MaxCapacity = int.MaxValue;
573 if (capacity == 0)
574 {
575 capacity = 16;
576 }
577 capacity = Math.Max(capacity, length);
578 m_ChunkChars = GC.AllocateUninitializedArray<char>(capacity);
580 value.AsSpan(startIndex, length).CopyTo(m_ChunkChars);
581 }

References System.SR.ArgumentOutOfRange_IndexLength, System.SR.ArgumentOutOfRange_MustBeNonNegNum, System.SR.ArgumentOutOfRange_MustBePositive, System.SR.ArgumentOutOfRange_StartIndex, System.capacity, System.SR.Format(), System.length, System.Text.StringBuilder.m_ChunkChars, System.Text.StringBuilder.m_ChunkLength, System.Text.StringBuilder.m_MaxCapacity, System.Math.Max(), System.startIndex, and System.value.