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

◆ GetBytes() [4/9]

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

Definition at line 145 of file ASCIIEncoding.cs.

146 {
147 if (chars == null || bytes == null)
148 {
149 ThrowHelper.ThrowArgumentNullException((chars == null) ? ExceptionArgument.chars : ExceptionArgument.bytes, ExceptionResource.ArgumentNull_Array);
150 }
151 if ((charIndex | charCount) < 0)
152 {
153 ThrowHelper.ThrowArgumentOutOfRangeException((charIndex < 0) ? ExceptionArgument.charIndex : ExceptionArgument.charCount, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
154 }
155 if (chars.Length - charIndex < charCount)
156 {
157 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.chars, ExceptionResource.ArgumentOutOfRange_IndexCount);
158 }
159 if ((uint)byteIndex > bytes.Length)
160 {
161 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.byteIndex, ExceptionResource.ArgumentOutOfRange_Index);
162 }
163 fixed (char* ptr = chars)
164 {
165 fixed (byte* ptr2 = bytes)
166 {
167 return GetBytesCommon(ptr + charIndex, charCount, ptr2 + byteIndex, bytes.Length - byteIndex);
168 }
169 }
170 }
unsafe int GetBytesCommon(char *pChars, int charCount, byte *pBytes, int byteCount)

References System.byteIndex, System.bytes, System.charCount, System.charIndex, System.chars, System.Text.ASCIIEncoding.GetBytesCommon(), System.ThrowHelper.ThrowArgumentNullException(), and System.ThrowHelper.ThrowArgumentOutOfRangeException().