Encoding is the process of transforming a set of characters into a sequence of bytes. Decoding is the reverse; it is the process of transforming a sequence of encoded bytes into a set of characters.
A Decoder maintains state information between successive calls to GetChars so it can correctly decode byte sequences that span blocks. The Decoder also preserves trailing bytes at the end of data blocks and uses the trailing bytes in the next decoding operation. Therefore, GetDecoder and GetEncoder are useful for network transmission and file operations, because those operations often deal with blocks of data instead of a complete data stream.
The GetCharCount method determines how many characters result in decoding a sequence of bytes, and the GetChars method performs the actual decoding.
To obtain an instance of an implementation of this class, use the GetDecoder method of an Encoding implementation.
Version Considerations
A Decoder or Encoder object can be serialized during a conversion operation. The state of the object is retained if it is deserialized in the same version of the .NET Framework, but lost if it is deserialized in another version.
Notes to Inheritors
When you inherit from this class, you must override all the members.