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

◆ GetBytes() [1/9]

virtual unsafe int System.Text.Encoding.GetBytes ( char * chars,
int charCount,
byte * bytes,
int byteCount )
inlinevirtualinherited

Reimplemented in System.Text.ConsoleEncoding, System.Text.ConsoleEncoding, System.Formats.Asn1.SpanBasedEncoding, System.Formats.Asn1.T61Encoding, System.Text.ASCIIEncoding, System.Text.Latin1Encoding, System.Text.UnicodeEncoding, System.Text.UTF32Encoding, System.Text.UTF7Encoding, System.Text.UTF8Encoding, and System.Text.EncodingNLS.

Definition at line 855 of file Encoding.cs.

856 {
857 if (bytes == null || chars == null)
858 {
859 throw new ArgumentNullException((bytes == null) ? "bytes" : "chars", SR.ArgumentNull_Array);
860 }
861 if (charCount < 0 || byteCount < 0)
862 {
863 throw new ArgumentOutOfRangeException((charCount < 0) ? "charCount" : "byteCount", SR.ArgumentOutOfRange_NeedNonNegNum);
864 }
865 char[] chars2 = new ReadOnlySpan<char>(chars, charCount).ToArray();
866 byte[] array = new byte[byteCount];
867 int bytes2 = GetBytes(chars2, 0, charCount, array, 0);
868 if (bytes2 < byteCount)
869 {
871 }
873 return byteCount;
874 }
void CopyTo(KeyValuePair< TKey, TValue >[] array, int index)
virtual byte[] GetBytes(char[] chars)
Definition Encoding.cs:781

References System.SR.ArgumentNull_Array, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.array, System.byteCount, System.bytes, System.charCount, System.chars, System.Collections.Generic.Dictionary< TKey, TValue >.CopyTo(), System.Runtime.Serialization.Dictionary, and System.Text.Encoding.GetBytes().