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

◆ GetBytes() [8/9]

unsafe override int System.Text.UnicodeEncoding.GetBytes ( string s,
int charIndex,
int charCount,
byte[] bytes,
int byteIndex )
inlinevirtual

Reimplemented from System.Text.Encoding.

Definition at line 161 of file UnicodeEncoding.cs.

162 {
163 if (s == null || bytes == null)
164 {
165 throw new ArgumentNullException((s == null) ? "s" : "bytes", SR.ArgumentNull_Array);
166 }
167 if (charIndex < 0 || charCount < 0)
168 {
169 throw new ArgumentOutOfRangeException((charIndex < 0) ? "charIndex" : "charCount", SR.ArgumentOutOfRange_NeedNonNegNum);
170 }
171 if (s.Length - charIndex < charCount)
172 {
173 throw new ArgumentOutOfRangeException("s", SR.ArgumentOutOfRange_IndexCount);
174 }
175 if (byteIndex < 0 || byteIndex > bytes.Length)
176 {
177 throw new ArgumentOutOfRangeException("byteIndex", SR.ArgumentOutOfRange_Index);
178 }
179 int byteCount = bytes.Length - byteIndex;
180 fixed (char* ptr = s)
181 {
182 fixed (byte* ptr2 = &MemoryMarshal.GetReference<byte>(bytes))
183 {
184 return GetBytes(ptr + charIndex, charCount, ptr2 + byteIndex, byteCount, null);
185 }
186 }
187 }
unsafe override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex)

References System.SR.ArgumentNull_Array, System.SR.ArgumentOutOfRange_Index, System.SR.ArgumentOutOfRange_IndexCount, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.byteCount, System.byteIndex, System.bytes, System.charCount, System.charIndex, System.Text.UnicodeEncoding.GetBytes(), and System.s.

Referenced by System.Text.UnicodeEncoding.GetBytes(), System.Text.UnicodeEncoding.GetBytes(), and System.Text.UnicodeEncoding.GetBytes().