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

◆ GetByteCount() [5/9]

unsafe override int System.Text.OSEncoding.GetByteCount ( char[] chars,
int index,
int count )
inline

Definition at line 29 of file OSEncoding.cs.

30 {
31 if (chars == null)
32 {
33 throw new ArgumentNullException("chars", System.SR.ArgumentNull_Array);
34 }
35 if (index < 0 || count < 0)
36 {
37 throw new ArgumentOutOfRangeException((index < 0) ? "index" : "count", System.SR.ArgumentOutOfRange_NeedNonNegNum);
38 }
39 if (chars.Length - index < count)
40 {
41 throw new ArgumentOutOfRangeException("chars", System.SR.ArgumentOutOfRange_IndexCountBuffer);
42 }
43 if (count == 0)
44 {
45 return 0;
46 }
47 fixed (char* ptr = chars)
48 {
49 return WideCharToMultiByte(_codePage, ptr + index, count, null, 0);
50 }
51 }
static string ArgumentOutOfRange_IndexCountBuffer
Definition SR.cs:78
static string ArgumentNull_Array
Definition SR.cs:24
Definition SR.cs:7
readonly int _codePage
Definition OSEncoding.cs:5
static unsafe int WideCharToMultiByte(int codePage, char *pChars, int count, byte *pBytes, int byteCount)

References System.Text.OSEncoding._codePage, System.SR.ArgumentNull_Array, System.SR.ArgumentOutOfRange_IndexCountBuffer, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.chars, System.count, System.index, and System.Text.OSEncoding.WideCharToMultiByte().