Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Encoder.Reset Method

Note: This method is new in the .NET Framework version 2.0.

When overridden in a derived class, sets the encoder back to its initial state.

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

[ComVisibleAttribute(false)] 
public virtual void Reset ()
/** @attribute ComVisibleAttribute(false) */ 
public void Reset ()
ComVisibleAttribute(false) 
public function Reset ()

An Encoder object maintains state information between successive calls to GetBytes so it can correctly encode character sequences that span blocks. A Encoder object also preserves trailing characters at the end of data blocks and uses the trailing characters in the next encoding operation. For example, a data block might end with an unmatched high-surrogate, and the matching low-surrogate might be in the next data block. Therefore, the Decoder and the Encoder classes are useful for network transmission and file operations, because those operations often deal with blocks of data instead of a complete data stream.

Reset clears any state information preserved from the previous call to GetBytes, including trailing characters at the end of the previous data block, such as an unmatched high-surrogate.

Reset is useful if you want to reuse the same encoder even after an exception is thrown by GetBytes or GetByteCount.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2015 Microsoft