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

◆ GetBytes() [9/9]

unsafe byte[] System.Text.Encoding.GetBytes ( string s,
int index,
int count )
inlineinherited

Definition at line 811 of file Encoding.cs.

812 {
813 if (s == null)
814 {
815 throw new ArgumentNullException("s", SR.ArgumentNull_String);
816 }
817 if (index < 0)
818 {
819 throw new ArgumentOutOfRangeException("index", SR.ArgumentOutOfRange_NeedNonNegNum);
820 }
821 if (count < 0)
822 {
823 throw new ArgumentOutOfRangeException("count", SR.ArgumentOutOfRange_NeedNonNegNum);
824 }
825 if (index > s.Length - count)
826 {
827 throw new ArgumentOutOfRangeException("index", SR.ArgumentOutOfRange_IndexCount);
828 }
829 fixed (char* ptr = s)
830 {
832 if (byteCount == 0)
833 {
834 return Array.Empty<byte>();
835 }
836 byte[] array = new byte[byteCount];
837 fixed (byte* bytes = &array[0])
838 {
840 }
841 return array;
842 }
843 }
virtual byte[] GetBytes(char[] chars)
Definition Encoding.cs:781
virtual int GetByteCount(char[] chars)
Definition Encoding.cs:713

References System.SR.ArgumentNull_String, System.SR.ArgumentOutOfRange_IndexCount, System.SR.ArgumentOutOfRange_NeedNonNegNum, System.array, System.byteCount, System.bytes, System.count, System.Runtime.Serialization.Dictionary, System.Text.Encoding.GetByteCount(), System.Text.Encoding.GetBytes(), System.index, and System.s.