Encoding::GetPreamble Method
When overridden in a derived class, returns a sequence of bytes that specifies the encoding used.
Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Return Value
Type: array<System::Byte>A byte array containing a sequence of bytes that specifies the encoding used.
-or-
A byte array of length zero, if a preamble is not required.
Optionally, the Encoding object provides a preamble that is an array of bytes that can be prefixed to the sequence of bytes resulting from the encoding process. If the preamble contains a byte order mark (in Unicode, code point U+FEFF), it helps the decoder determine the byte order and the transformation format or UTF.
The Unicode byte order mark (BOM) is serialized as follows (in hexadecimal):
UTF-8: EF BB BF
UTF-16 big-endian byte order: FE FF
UTF-16 little-endian byte order: FF FE
Caution: |
|---|
To ensure that the encoded bytes are decoded properly, your application should prefix encoded bytes with a preamble. However, most encodings do not provide a preamble. To ensure that the encoded bytes are decoded properly, the application should use the UTF8Encoding or UnicodeEncoding Unicode encodings with a preamble. |
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Caution: