mscorlib(4.0.0.0) API with additions
|
Represents a UTF-16 encoding of Unicode characters. More...
Public Member Functions | |
UnicodeEncoding () | |
Initializes a new instance of the T:System.Text.UnicodeEncoding class. More... | |
UnicodeEncoding (bool bigEndian, bool byteOrderMark) | |
Initializes a new instance of the T:System.Text.UnicodeEncoding class. Parameters specify whether to use the big endian byte order and whether the M:System.Text.UnicodeEncoding.GetPreamble method returns a Unicode byte order mark. More... | |
UnicodeEncoding? (bool bigEndian, bool byteOrderMark, bool throwOnInvalidBytes) | |
Initializes a new instance of the T:System.Text.UnicodeEncoding class. Parameters specify whether to use the big endian byte order, whether to provide a Unicode byte order mark, and whether to throw an exception when an invalid encoding is detected. More... | |
unsafe override int | GetByteCount (char[] chars, int index, int count) |
Calculates the number of bytes produced by encoding a set of characters from the specified character array. More... | |
unsafe override int | GetByteCount (string s) |
Calculates the number of bytes produced by encoding the characters in the specified string. More... | |
unsafe override int | GetByteCount (char *chars, int count) |
Calculates the number of bytes produced by encoding a set of characters starting at the specified character pointer. More... | |
unsafe override int | GetBytes (string s, int charIndex, int charCount, byte[] bytes, int byteIndex) |
Encodes a set of characters from the specified T:System.String into the specified byte array. More... | |
unsafe override int | GetBytes (char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex) |
Encodes a set of characters from the specified character array into the specified byte array. More... | |
unsafe override int | GetBytes (char *chars, int charCount, byte *bytes, int byteCount) |
Encodes a set of characters starting at the specified character pointer into a sequence of bytes that are stored starting at the specified byte pointer. More... | |
unsafe override int | GetCharCount (byte[] bytes, int index, int count) |
Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array. More... | |
unsafe override int | GetCharCount (byte *bytes, int count) |
Calculates the number of characters produced by decoding a sequence of bytes starting at the specified byte pointer. More... | |
unsafe override int | GetChars (byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex) |
Decodes a sequence of bytes from the specified byte array into the specified character array. More... | |
unsafe override int | GetChars (byte *bytes, int byteCount, char *chars, int charCount) |
Decodes a sequence of bytes starting at the specified byte pointer into a set of characters that are stored starting at the specified character pointer. More... | |
unsafe override string | GetString (byte[] bytes, int index, int count) |
Decodes a range of bytes from a byte array into a string. More... | |
override Encoder | GetEncoder () |
Obtains an encoder that converts a sequence of Unicode characters into a UTF-16 encoded sequence of bytes. More... | |
override System.Text.Decoder | GetDecoder () |
Obtains a decoder that converts a UTF-16 encoded sequence of bytes into a sequence of Unicode characters. More... | |
override byte [] | GetPreamble () |
Returns a Unicode byte order mark encoded in UTF-16 format, if the constructor for this instance requests a byte order mark. More... | |
override int | GetMaxByteCount (int charCount) |
Calculates the maximum number of bytes produced by encoding the specified number of characters. More... | |
override int | GetMaxCharCount (int byteCount) |
Calculates the maximum number of characters produced by decoding the specified number of bytes. More... | |
override bool | Equals (object value) |
Determines whether the specified T:System.Object is equal to the current T:System.Text.UnicodeEncoding object. More... | |
override int | GetHashCode () |
Returns the hash code for the current instance. More... | |
![]() | |
virtual object | Clone () |
When overridden in a derived class, creates a shallow copy of the current T:System.Text.Encoding object. More... | |
virtual int | GetByteCount (char[] chars) |
When overridden in a derived class, calculates the number of bytes produced by encoding all the characters in the specified character array. More... | |
virtual byte [] | GetBytes (char[] chars) |
When overridden in a derived class, encodes all the characters in the specified character array into a sequence of bytes. More... | |
virtual byte [] | GetBytes (char[] chars, int index, int count) |
When overridden in a derived class, encodes a set of characters from the specified character array into a sequence of bytes. More... | |
virtual byte [] | GetBytes (string s) |
When overridden in a derived class, encodes all the characters in the specified string into a sequence of bytes. More... | |
virtual int | GetCharCount (byte[] bytes) |
When overridden in a derived class, calculates the number of characters produced by decoding all the bytes in the specified byte array. More... | |
virtual char [] | GetChars (byte[] bytes) |
When overridden in a derived class, decodes all the bytes in the specified byte array into a set of characters. More... | |
virtual char [] | GetChars (byte[] bytes, int index, int count) |
When overridden in a derived class, decodes a sequence of bytes from the specified byte array into a set of characters. More... | |
unsafe string | GetString (byte *bytes, int byteCount) |
When overridden in a derived class, decodes a specified number of bytes starting at a specified address into a string. More... | |
bool | IsAlwaysNormalized () |
Gets a value indicating whether the current encoding is always normalized, using the default normalization form. More... | |
virtual bool | IsAlwaysNormalized (NormalizationForm form) |
When overridden in a derived class, gets a value indicating whether the current encoding is always normalized, using the specified normalization form. More... | |
virtual string | GetString (byte[] bytes) |
When overridden in a derived class, decodes all the bytes in the specified byte array into a string. More... | |
override bool | Equals (object value) |
Determines whether the specified T:System.Object is equal to the current instance. More... | |
override int | GetHashCode () |
Returns the hash code for the current instance. More... | |
Public Attributes | |
const int | CharSize = 2 |
Represents the Unicode character size in bytes. This field is a constant. More... | |
Additional Inherited Members | |
![]() | |
static byte [] | Convert (Encoding srcEncoding, Encoding dstEncoding, byte[] bytes) |
Converts an entire byte array from one encoding to another. More... | |
static byte [] | Convert (Encoding srcEncoding, Encoding dstEncoding, byte[] bytes, int index, int count) |
Converts a range of bytes in a byte array from one encoding to another. More... | |
static void | RegisterProvider (EncodingProvider provider) |
Registers an encoding provider. More... | |
static Encoding | GetEncoding (int codepage) |
Returns the encoding associated with the specified code page identifier. More... | |
static Encoding | GetEncoding (int codepage, EncoderFallback encoderFallback, DecoderFallback decoderFallback) |
Returns the encoding associated with the specified code page identifier. Parameters specify an error handler for characters that cannot be encoded and byte sequences that cannot be decoded. More... | |
static Encoding | GetEncoding (string name) |
Returns the encoding associated with the specified code page name. More... | |
static Encoding | GetEncoding (string name, EncoderFallback encoderFallback, DecoderFallback decoderFallback) |
Returns the encoding associated with the specified code page name. Parameters specify an error handler for characters that cannot be encoded and byte sequences that cannot be decoded. More... | |
static EncodingInfo [] | GetEncodings () |
Returns an array that contains all encodings. More... | |
![]() | |
Encoding () | |
Initializes a new instance of the T:System.Text.Encoding class. More... | |
Encoding (int codePage) | |
Initializes a new instance of the T:System.Text.Encoding class that corresponds to the specified code page. More... | |
Encoding (int codePage, EncoderFallback encoderFallback, DecoderFallback decoderFallback) | |
Initializes a new instance of the T:System.Text.Encoding class that corresponds to the specified code page with the specified encoder and decoder fallback strategies. More... | |
![]() | |
virtual string | BodyName [get] |
When overridden in a derived class, gets a name for the current encoding that can be used with mail agent body tags. More... | |
virtual string | EncodingName [get] |
When overridden in a derived class, gets the human-readable description of the current encoding. More... | |
virtual string | HeaderName [get] |
When overridden in a derived class, gets a name for the current encoding that can be used with mail agent header tags. More... | |
virtual string | WebName [get] |
When overridden in a derived class, gets the name registered with the Internet Assigned Numbers Authority (IANA) for the current encoding. More... | |
virtual int | WindowsCodePage [get] |
When overridden in a derived class, gets the Windows operating system code page that most closely corresponds to the current encoding. More... | |
virtual bool | IsBrowserDisplay [get] |
When overridden in a derived class, gets a value indicating whether the current encoding can be used by browser clients for displaying content. More... | |
virtual bool | IsBrowserSave [get] |
When overridden in a derived class, gets a value indicating whether the current encoding can be used by browser clients for saving content. More... | |
virtual bool | IsMailNewsDisplay [get] |
When overridden in a derived class, gets a value indicating whether the current encoding can be used by mail and news clients for displaying content. More... | |
virtual bool | IsMailNewsSave [get] |
When overridden in a derived class, gets a value indicating whether the current encoding can be used by mail and news clients for saving content. More... | |
virtual bool | IsSingleByte [get] |
When overridden in a derived class, gets a value indicating whether the current encoding uses single-byte code points. More... | |
EncoderFallback | EncoderFallback [get, set] |
Gets or sets the T:System.Text.EncoderFallback object for the current T:System.Text.Encoding object. More... | |
DecoderFallback | DecoderFallback [get, set] |
Gets or sets the T:System.Text.DecoderFallback object for the current T:System.Text.Encoding object. More... | |
bool | IsReadOnly [get] |
When overridden in a derived class, gets a value indicating whether the current encoding is read-only. More... | |
static Encoding | ASCII [get] |
Gets an encoding for the ASCII (7-bit) character set. More... | |
virtual int | CodePage [get] |
When overridden in a derived class, gets the code page identifier of the current T:System.Text.Encoding. More... | |
static Encoding | Default [get] |
Gets an encoding for the operating system's current ANSI code page. More... | |
static Encoding | Unicode [get] |
Gets an encoding for the UTF-16 format using the little endian byte order. More... | |
static Encoding | BigEndianUnicode [get] |
Gets an encoding for the UTF-16 format that uses the big endian byte order. More... | |
static Encoding | UTF7 [get] |
Gets an encoding for the UTF-7 format. More... | |
static Encoding | UTF8 [get] |
Gets an encoding for the UTF-8 format. More... | |
static Encoding | UTF32 [get] |
Gets an encoding for the UTF-32 format using the little endian byte order. More... | |
Represents a UTF-16 encoding of Unicode characters.
Definition at line 11 of file UnicodeEncoding.cs.
System.Text.UnicodeEncoding.UnicodeEncoding | ( | ) |
Initializes a new instance of the T:System.Text.UnicodeEncoding class.
Definition at line 94 of file UnicodeEncoding.cs.
System.Text.UnicodeEncoding.UnicodeEncoding | ( | bool | bigEndian, |
bool | byteOrderMark | ||
) |
Initializes a new instance of the T:System.Text.UnicodeEncoding class. Parameters specify whether to use the big endian byte order and whether the M:System.Text.UnicodeEncoding.GetPreamble method returns a Unicode byte order mark.
bigEndian | true to use the big endian byte order (most significant byte first), or false to use the little endian byte order (least significant byte first). |
byteOrderMark | true to specify that the M:System.Text.UnicodeEncoding.GetPreamble method returns a Unicode byte order mark; otherwise, false . See the Remarks section for more information. |
Definition at line 105 of file UnicodeEncoding.cs.
override bool System.Text.UnicodeEncoding.Equals | ( | object | value | ) |
Determines whether the specified T:System.Object is equal to the current T:System.Text.UnicodeEncoding object.
value | The object to compare with the current object. |
true
if value is an instance of T:System.Text.UnicodeEncoding and is equal to the current object; otherwise, false
.Definition at line 1475 of file UnicodeEncoding.cs.
|
virtual |
Calculates the number of bytes produced by encoding a set of characters from the specified character array.
chars | The character array containing the set of characters to encode. |
index | The index of the first character to encode. |
count | The number of characters to encode. |
T:System.ArgumentNullException | chars is null (Nothing ). |
T:System.ArgumentOutOfRangeException | index or count is less than zero.-or- index and count do not denote a valid range in chars .-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. |
T:System.ArgumentException | Error detection is enabled, and chars contains an invalid sequence of characters. |
T:System.Text.EncoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoding.EncoderFallback is set to T:System.Text.EncoderExceptionFallback. |
Implements System.Text.Encoding.
Definition at line 165 of file UnicodeEncoding.cs.
|
virtual |
Calculates the number of bytes produced by encoding the characters in the specified string.
s | The string that contains the set of characters to encode. |
T:System.ArgumentNullException | s is null . |
T:System.ArgumentOutOfRangeException | The resulting number of bytes is greater than the maximum number that can be returned as an integer. |
T:System.ArgumentException | Error detection is enabled, and s contains an invalid sequence of characters. |
T:System.Text.EncoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoding.EncoderFallback is set to T:System.Text.EncoderExceptionFallback. |
Reimplemented from System.Text.Encoding.
Definition at line 200 of file UnicodeEncoding.cs.
|
virtual |
Calculates the number of bytes produced by encoding a set of characters starting at the specified character pointer.
chars | A pointer to the first character to encode. |
count | The number of characters to encode. |
T:System.ArgumentNullException | chars is null . |
T:System.ArgumentOutOfRangeException | count is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. |
T:System.ArgumentException | Error detection is enabled and chars contains an invalid sequence of characters. |
T:System.Text.EncoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoding.EncoderFallback is set to T:System.Text.EncoderExceptionFallback. |
Reimplemented from System.Text.Encoding.
Definition at line 226 of file UnicodeEncoding.cs.
|
virtual |
Encodes a set of characters from the specified T:System.String into the specified byte array.
s | The string containing the set of characters to encode. |
charIndex | The index of the first character to encode. |
charCount | The number of characters to encode. |
bytes | The byte array to contain the resulting sequence of bytes. |
byteIndex | The index at which to start writing the resulting sequence of bytes. |
T:System.ArgumentNullException | s is null .-or- bytes is null (Nothing ). |
T:System.ArgumentOutOfRangeException | charIndex or charCount or byteIndex is less than zero.-or- charIndex and charCount do not denote a valid range in chars .-or- byteIndex is not a valid index in bytes . |
T:System.ArgumentException | Error detection is enabled, and s contains an invalid sequence of characters.-or- bytes does not have enough capacity from byteIndex to the end of the array to accommodate the resulting bytes. |
T:System.Text.EncoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoding.EncoderFallback is set to T:System.Text.EncoderExceptionFallback. |
Reimplemented from System.Text.Encoding.
Definition at line 259 of file UnicodeEncoding.cs.
|
virtual |
Encodes a set of characters from the specified character array into the specified byte array.
chars | The character array containing the set of characters to encode. |
charIndex | The index of the first character to encode. |
charCount | The number of characters to encode. |
bytes | The byte array to contain the resulting sequence of bytes. |
byteIndex | The index at which to start writing the resulting sequence of bytes. |
T:System.ArgumentNullException | chars is null (Nothing ).-or- bytes is null (Nothing ). |
T:System.ArgumentOutOfRangeException | charIndex or charCount or byteIndex is less than zero.-or- charIndex and charCount do not denote a valid range in chars .-or- byteIndex is not a valid index in bytes . |
T:System.ArgumentException | Error detection is enabled, and chars contains an invalid sequence of characters.-or- bytes does not have enough capacity from byteIndex to the end of the array to accommodate the resulting bytes. |
T:System.Text.EncoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoding.EncoderFallback is set to T:System.Text.EncoderExceptionFallback. |
Implements System.Text.Encoding.
Definition at line 312 of file UnicodeEncoding.cs.
|
virtual |
Encodes a set of characters starting at the specified character pointer into a sequence of bytes that are stored starting at the specified byte pointer.
chars | A pointer to the first character to encode. |
charCount | The number of characters to encode. |
bytes | A pointer to the location at which to start writing the resulting sequence of bytes. |
byteCount | The maximum number of bytes to write. |
T:System.ArgumentNullException | chars is null (Nothing ).-or- bytes is null (Nothing ). |
T:System.ArgumentOutOfRangeException | charCount or byteCount is less than zero. |
T:System.ArgumentException | Error detection is enabled, and chars contains an invalid sequence of characters.-or- byteCount is less than the resulting number of bytes. |
T:System.Text.EncoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoding.EncoderFallback is set to T:System.Text.EncoderExceptionFallback. |
Reimplemented from System.Text.Encoding.
Definition at line 367 of file UnicodeEncoding.cs.
|
virtual |
Calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.
bytes | The byte array containing the sequence of bytes to decode. |
index | The index of the first byte to decode. |
count | The number of bytes to decode. |
T:System.ArgumentNullException | bytes is null (Nothing ). |
T:System.ArgumentOutOfRangeException | index or count is less than zero.-or- index and count do not denote a valid range in bytes .-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. |
T:System.ArgumentException | Error detection is enabled, and bytes contains an invalid sequence of bytes. |
T:System.Text.DecoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoding.DecoderFallback is set to T:System.Text.DecoderExceptionFallback. |
Implements System.Text.Encoding.
Definition at line 395 of file UnicodeEncoding.cs.
|
virtual |
Calculates the number of characters produced by decoding a sequence of bytes starting at the specified byte pointer.
bytes | A pointer to the first byte to decode. |
count | The number of bytes to decode. |
T:System.ArgumentNullException | bytes is null (Nothing ). |
T:System.ArgumentOutOfRangeException | count is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. |
T:System.ArgumentException | Error detection is enabled, and bytes contains an invalid sequence of bytes. |
T:System.Text.DecoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoding.DecoderFallback is set to T:System.Text.DecoderExceptionFallback. |
Reimplemented from System.Text.Encoding.
Definition at line 433 of file UnicodeEncoding.cs.
|
virtual |
Decodes a sequence of bytes from the specified byte array into the specified character array.
bytes | The byte array containing the sequence of bytes to decode. |
byteIndex | The index of the first byte to decode. |
byteCount | The number of bytes to decode. |
chars | The character array to contain the resulting set of characters. |
charIndex | The index at which to start writing the resulting set of characters. |
T:System.ArgumentNullException | bytes is null (Nothing ).-or- chars is null (Nothing ). |
T:System.ArgumentOutOfRangeException | byteIndex or byteCount or charIndex is less than zero.-or- byteindex and byteCount do not denote a valid range in bytes .-or- charIndex is not a valid index in chars . |
T:System.ArgumentException | Error detection is enabled, and bytes contains an invalid sequence of bytes.-or- chars does not have enough capacity from charIndex to the end of the array to accommodate the resulting characters. |
T:System.Text.DecoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoding.DecoderFallback is set to T:System.Text.DecoderExceptionFallback. |
Implements System.Text.Encoding.
Definition at line 466 of file UnicodeEncoding.cs.
|
virtual |
Decodes a sequence of bytes starting at the specified byte pointer into a set of characters that are stored starting at the specified character pointer.
bytes | A pointer to the first byte to decode. |
byteCount | The number of bytes to decode. |
chars | A pointer to the location at which to start writing the resulting set of characters. |
charCount | The maximum number of characters to write. |
T:System.ArgumentNullException | bytes is null (Nothing ).-or- chars is null (Nothing ). |
T:System.ArgumentOutOfRangeException | byteCount or charCount is less than zero. |
T:System.ArgumentException | Error detection is enabled, and bytes contains an invalid sequence of bytes.-or- charCount is less than the resulting number of characters. |
T:System.Text.DecoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoding.DecoderFallback is set to T:System.Text.DecoderExceptionFallback. |
Reimplemented from System.Text.Encoding.
Definition at line 521 of file UnicodeEncoding.cs.
|
virtual |
Obtains a decoder that converts a UTF-16 encoded sequence of bytes into a sequence of Unicode characters.
Reimplemented from System.Text.Encoding.
Definition at line 1388 of file UnicodeEncoding.cs.
|
virtual |
Obtains an encoder that converts a sequence of Unicode characters into a UTF-16 encoded sequence of bytes.
Reimplemented from System.Text.Encoding.
Definition at line 1380 of file UnicodeEncoding.cs.
override int System.Text.UnicodeEncoding.GetHashCode | ( | ) |
Returns the hash code for the current instance.
Definition at line 1492 of file UnicodeEncoding.cs.
|
virtual |
Calculates the maximum number of bytes produced by encoding the specified number of characters.
charCount | The number of characters to encode. |
T:System.ArgumentOutOfRangeException | charCount is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. |
T:System.Text.EncoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoding.EncoderFallback is set to T:System.Text.EncoderExceptionFallback. |
Implements System.Text.Encoding.
Definition at line 1425 of file UnicodeEncoding.cs.
|
virtual |
Calculates the maximum number of characters produced by decoding the specified number of bytes.
byteCount | The number of bytes to decode. |
T:System.ArgumentOutOfRangeException | byteCount is less than zero.-or- The resulting number of bytes is greater than the maximum number that can be returned as an integer. |
T:System.Text.DecoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoding.DecoderFallback is set to T:System.Text.DecoderExceptionFallback. |
Implements System.Text.Encoding.
Definition at line 1452 of file UnicodeEncoding.cs.
|
virtual |
Returns a Unicode byte order mark encoded in UTF-16 format, if the constructor for this instance requests a byte order mark.
Reimplemented from System.Text.Encoding.
Definition at line 1396 of file UnicodeEncoding.cs.
|
virtual |
Decodes a range of bytes from a byte array into a string.
bytes | The byte array containing the sequence of bytes to decode. |
index | The index of the first byte to decode. |
count | The number of bytes to decode. |
T:System.ArgumentNullException | bytes is null (Nothing ). |
T:System.ArgumentOutOfRangeException | index or count is less than zero.-or- index and count do not denote a valid range in bytes . |
T:System.ArgumentException | Error detection is enabled, and bytes contains an invalid sequence of bytes. |
T:System.Text.DecoderFallbackException | A fallback occurred (see Character Encoding in the .NET Framework for fuller explanation)-and- P:System.Text.Encoding.DecoderFallback is set to T:System.Text.DecoderExceptionFallback. |
Reimplemented from System.Text.Encoding.
Definition at line 550 of file UnicodeEncoding.cs.
System.Text.UnicodeEncoding.UnicodeEncoding? | ( | bool | bigEndian, |
bool | byteOrderMark, | ||
bool | throwOnInvalidBytes | ||
) |
Initializes a new instance of the T:System.Text.UnicodeEncoding class. Parameters specify whether to use the big endian byte order, whether to provide a Unicode byte order mark, and whether to throw an exception when an invalid encoding is detected.
bigEndian | true to use the big endian byte order (most significant byte first); false to use the little endian byte order (least significant byte first). |
byteOrderMark | true to specify that the M:System.Text.UnicodeEncoding.GetPreamble method returns a Unicode byte order mark; otherwise, false . See the Remarks section for more information. |
throwOnInvalidBytes | true to specify that an exception should be thrown when an invalid encoding is detected; otherwise, false . |
Definition at line 118 of file UnicodeEncoding.cs.
const int System.Text.UnicodeEncoding.CharSize = 2 |
Represents the Unicode character size in bytes. This field is a constant.
Definition at line 90 of file UnicodeEncoding.cs.