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

◆ Ctor() [2/9]

unsafe string System.String.Ctor ( char * ptr,
int startIndex,
int length )
inlineprivate

Definition at line 975 of file String.cs.

976 {
977 if (length < 0)
978 {
979 throw new ArgumentOutOfRangeException("length", SR.ArgumentOutOfRange_NegativeLength);
980 }
981 if (startIndex < 0)
982 {
983 throw new ArgumentOutOfRangeException("startIndex", SR.ArgumentOutOfRange_StartIndex);
984 }
985 char* ptr2 = ptr + startIndex;
986 if (ptr2 < ptr)
987 {
988 throw new ArgumentOutOfRangeException("startIndex", SR.ArgumentOutOfRange_PartialWCHAR);
989 }
990 if (length == 0)
991 {
992 return Empty;
993 }
994 if (ptr == null)
995 {
996 throw new ArgumentOutOfRangeException("ptr", SR.ArgumentOutOfRange_PartialWCHAR);
997 }
999 nuint elementCount = (uint)text.Length;
1000 Buffer.Memmove(ref text._firstChar, ref *ptr2, elementCount);
1001 return text;
1002 }
static readonly string Empty
Definition String.cs:29
static string FastAllocateString(int length)

References System.SR.ArgumentOutOfRange_NegativeLength, System.SR.ArgumentOutOfRange_PartialWCHAR, System.SR.ArgumentOutOfRange_StartIndex, System.String.Empty, System.String.FastAllocateString(), System.length, System.Buffer.Memmove(), System.startIndex, and System.text.