Share via


Encoding Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Represents a character encoding.

Inheritance Hierarchy

System. . :: . .Object
  System.Text..::..Encoding
    System.Text. . :: . .UTF8Encoding

Namespace:  System.Text
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
<SerializableAttribute> _
Public MustInherit Class Encoding
[SerializableAttribute]
public abstract class Encoding
[SerializableAttribute]
public ref class Encoding abstract
[<AbstractClass>]
[<SerializableAttribute>]
type Encoding =  class end
public abstract class Encoding

The Encoding type exposes the following members.

Constructors

  Name Description
Protected method Encoding Initializes a new instance of the Encoding class.

Top

Properties

  Name Description
Public propertyStatic member UTF8 Gets an encoding for the UTF-8 format.

Top

Methods

  Name Description
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetBytes(String) When overridden in a derived class, encodes all the characters in the specified string into a sequence of bytes.
Public method GetBytes(String, Int32, Int32, array<Byte> [] () [] [], Int32) When overridden in a derived class, encodes a set of characters from the specified string into the specified byte array.
Public method GetChars(array<Byte> [] () [] []) When overridden in a derived class, decodes all the bytes in the specified byte array into a set of characters.
Public method GetChars(array<Byte> [] () [] [], Int32, Int32) When overridden in a derived class, decodes a sequence of bytes from the specified byte array into a set of characters.
Public method GetDecoder When overridden in a derived class, obtains a decoder that converts an encoded sequence of bytes into a sequence of characters.
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

Encoding is the process of transforming a set of Unicode characters into a sequence of bytes. In contrast, decoding is the process of transforming a sequence of encoded bytes into a set of Unicode characters.

The Encoding class is primarily intended to convert between different encodings and Unicode. Often one of the derived Unicode classes is the correct choice for your application.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.Text Namespace