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

◆ Ctor() [9/9]

unsafe string System.String.Ctor ( sbyte * value,
int startIndex,
int length,
Encoding enc )
inlineprivate

Definition at line 1078 of file String.cs.

1079 {
1080 if (enc == null)
1081 {
1082 return new string(value, startIndex, length);
1083 }
1084 if (length < 0)
1085 {
1086 throw new ArgumentOutOfRangeException("length", SR.ArgumentOutOfRange_NeedNonNegNum);
1087 }
1088 if (startIndex < 0)
1089 {
1090 throw new ArgumentOutOfRangeException("startIndex", SR.ArgumentOutOfRange_StartIndex);
1091 }
1092 if (value == null)
1093 {
1094 if (length == 0)
1095 {
1096 return Empty;
1097 }
1098 throw new ArgumentNullException("value");
1099 }
1100 byte* ptr = (byte*)(value + startIndex);
1101 if (ptr < value)
1102 {
1103 throw new ArgumentOutOfRangeException("startIndex", SR.ArgumentOutOfRange_PartialWCHAR);
1104 }
1105 return enc.GetString(new ReadOnlySpan<byte>(ptr, length));
1106 }
static readonly string Empty
Definition String.cs:29

References System.SR.ArgumentOutOfRange_NeedNonNegNum, System.SR.ArgumentOutOfRange_PartialWCHAR, System.SR.ArgumentOutOfRange_StartIndex, System.String.Empty, System.length, System.startIndex, and System.value.