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

◆ CreateStringForSByteConstructor()

static unsafe string System.String.CreateStringForSByteConstructor ( byte * pb,
int numBytes )
inlinestaticprivate

Definition at line 1050 of file String.cs.

1051 {
1052 if (numBytes == 0)
1053 {
1054 return Empty;
1055 }
1056 int num = Interop.Kernel32.MultiByteToWideChar(0u, 1u, pb, numBytes, null, 0);
1057 if (num == 0)
1058 {
1059 throw new ArgumentException(SR.Arg_InvalidANSIString);
1060 }
1061 string text = FastAllocateString(num);
1062 fixed (char* lpWideCharStr = &text._firstChar)
1063 {
1065 }
1066 if (num == 0)
1067 {
1068 throw new ArgumentException(SR.Arg_InvalidANSIString);
1069 }
1070 return text;
1071 }
static unsafe int MultiByteToWideChar(uint CodePage, uint dwFlags, byte *lpMultiByteStr, int cbMultiByte, char *lpWideCharStr, int cchWideChar)
static readonly string Empty
Definition String.cs:29
static string FastAllocateString(int length)

References System.SR.Arg_InvalidANSIString, System.String.Empty, System.String.FastAllocateString(), Interop.Kernel32.MultiByteToWideChar(), and System.text.

Referenced by System.String.Ctor(), and System.String.Ctor().