class UnicodeEncoding

in global :: System . Text

Represents a UTF-16 encoding of Unicode characters.


public UnicodeEncoding( bool bigEndian, bool byteOrderMark )

Initializes a new instance of the class. Parameters specify whether to use the big endian byte order and whether the method returns a Unicode byte order mark.

  • bigEndian to use the big endian byte order (most significant byte first), or to use the little endian byte order (least significant byte first).
  • byteOrderMark to specify that the method returns a Unicode byte order mark; otherwise, .

public UnicodeEncoding( bool bigEndian, bool byteOrderMark, bool throwOnInvalidBytes )

Initializes a new instance of the 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 to use the big endian byte order (most significant byte first); to use the little endian byte order (least significant byte first).
  • byteOrderMark to specify that the method returns a Unicode byte order mark; otherwise, .
  • throwOnInvalidBytes to specify that an exception should be thrown when an invalid encoding is detected; otherwise, .

public static int CharSize

Represents the Unicode character size in bytes. This field is a constant.

public bool Equals( object value )

Determines whether the specified is equal to the current object.

  • value The object to compare with the current object.
  • Returns if is an instance of and is equal to the current object; otherwise, .

public int GetByteCount( char* chars, int count )

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.
  • Returns The number of bytes produced by encoding the specified characters.

public 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.

  • 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.
  • Returns The number of bytes produced by encoding the specified characters.

public int GetByteCount( string s )

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.
  • Returns The number of bytes produced by encoding the specified characters.

public 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.

  • 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.
  • Returns The actual number of bytes written at the location indicated by the parameter.

public 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.

  • 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.
  • Returns The actual number of bytes written into .

public int GetBytes( string s, int charIndex, int charCount, byte[] bytes, int byteIndex )

Encodes a set of characters from the specified 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.
  • Returns The actual number of bytes written into .

public int GetCharCount( byte* bytes, int count )

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.
  • Returns The number of characters produced by decoding the specified sequence of bytes.

public 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.

  • 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.
  • Returns The number of characters produced by decoding the specified sequence of bytes.

public 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.

  • 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.
  • Returns The actual number of characters written at the location indicated by the parameter.

public 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.

  • 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.
  • Returns The actual number of characters written into .

public int GetMaxByteCount( int charCount )

Calculates the maximum number of bytes produced by encoding the specified number of characters.

  • charCount The number of characters to encode.
  • Returns The maximum number of bytes produced by encoding the specified number of characters.

public int GetMaxCharCount( int byteCount )

Calculates the maximum number of characters produced by decoding the specified number of bytes.

  • byteCount The number of bytes to decode.
  • Returns The maximum number of characters produced by decoding the specified number of bytes.

public string GetString( byte[] bytes, int index, int count )

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.
  • Returns A object containing the results of decoding the specified sequence of bytes.

public char[] GetChars( byte[] bytes, int index, int count )

😔 No documentation found.

public byte[] GetBytes( string s, int index, int count )

😔 No documentation found.

public bool TryGetBytes( ReadOnlySpan<char> chars, Span<byte> bytes, ref int bytesWritten )

😔 No documentation found.

public int GetCharCount( byte[] bytes )

😔 No documentation found.

public int GetCharCount( ReadOnlySpan<byte> bytes )

😔 No documentation found.

public char[] GetChars( byte[] bytes )

😔 No documentation found.

public int GetBytes( ReadOnlySpan<char> chars, Span<byte> bytes )

😔 No documentation found.

public int GetChars( ReadOnlySpan<byte> bytes, Span<char> chars )

😔 No documentation found.

public byte[] GetBytes( char[] chars, int index, int count )

😔 No documentation found.

public string GetString( byte* bytes, int byteCount )

😔 No documentation found.

public string GetString( ReadOnlySpan<byte> bytes )

😔 No documentation found.

public byte[] GetBytes( string s )

😔 No documentation found.

public bool IsAlwaysNormalized( )

😔 No documentation found.

public bool IsAlwaysNormalized( NormalizationForm form )

😔 No documentation found.

public string GetString( byte[] bytes )

😔 No documentation found.

public Type GetType( )

😔 No documentation found.

public string ToString( )

😔 No documentation found.

public UnicodeEncoding( )

😔 No documentation found.

public bool TryGetChars( ReadOnlySpan<byte> bytes, Span<char> chars, ref int charsWritten )

😔 No documentation found.

public int CodePage { get; }

😔 No documentation found.

public EncoderFallback EncoderFallback { get; set; }

😔 No documentation found.

public bool IsReadOnly { get; }

😔 No documentation found.

public Encoder GetEncoder( )

😔 No documentation found.

public Decoder GetDecoder( )

😔 No documentation found.

public byte[] GetPreamble( )

😔 No documentation found.

public ReadOnlySpan<byte> Preamble { get; }

😔 No documentation found.

public int GetHashCode( )

😔 No documentation found.

public string BodyName { get; }

😔 No documentation found.

public string EncodingName { get; }

😔 No documentation found.

public string HeaderName { get; }

😔 No documentation found.

public string WebName { get; }

😔 No documentation found.

public int WindowsCodePage { get; }

😔 No documentation found.

public bool IsBrowserDisplay { get; }

😔 No documentation found.

public bool IsBrowserSave { get; }

😔 No documentation found.

public bool IsMailNewsDisplay { get; }

😔 No documentation found.

public bool IsMailNewsSave { get; }

😔 No documentation found.

public bool IsSingleByte { get; }

😔 No documentation found.

public DecoderFallback DecoderFallback { get; set; }

😔 No documentation found.

public object Clone( )

😔 No documentation found.

public int GetByteCount( char[] chars )

😔 No documentation found.

public int GetByteCount( string s, int index, int count )

😔 No documentation found.

public byte[] GetBytes( char[] chars )

😔 No documentation found.

public int GetByteCount( ReadOnlySpan<char> chars )

😔 No documentation found.