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

◆ GetBytes() [4/9]

unsafe override int System.Text.UnicodeEncoding.GetBytes ( char[] chars,
int charIndex,
int charCount,
byte[] bytes,
int byteIndex )
inline

Definition at line 189 of file UnicodeEncoding.cs.

190 {
191 if (chars == null || bytes == null)
192 {
193 throw new ArgumentNullException((chars == null) ? "chars" : "bytes", SR.ArgumentNull_Array);
194 }
195 if (charIndex < 0 || charCount < 0)
196 {
197 throw new ArgumentOutOfRangeException((charIndex < 0) ? "charIndex" : "charCount", SR.ArgumentOutOfRange_NeedNonNegNum);
198 }
199 if (chars.Length - charIndex < charCount)
200 {
201 throw new ArgumentOutOfRangeException("chars", SR.ArgumentOutOfRange_IndexCountBuffer);
202 }
203 if (byteIndex < 0 || byteIndex > bytes.Length)
204 {
205 throw new ArgumentOutOfRangeException("byteIndex", SR.ArgumentOutOfRange_Index);
206 }
207 if (charCount == 0)
208 {
209 return 0;
210 }
211 int byteCount = bytes.Length - byteIndex;
212 fixed (char* ptr = chars)
213 {
214 fixed (byte* ptr2 = &MemoryMarshal.GetReference<byte>(bytes))
215 {
216 return GetBytes(ptr + charIndex, charCount, ptr2 + byteIndex, byteCount, null);
217 }
218 }
219 }
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_IndexCountBuffer, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.byteCount, System.byteIndex, System.bytes, System.charCount, System.charIndex, System.chars, and System.Text.UnicodeEncoding.GetBytes().