Encoding.GetDecoder 方法

在派生类中重写时,获取一个解码器,该解码器将已编码的字节序列转换为字符序列。

**命名空间:**System.Text
**程序集:**mscorlib(在 mscorlib.dll 中)

语法

声明
Public Overridable Function GetDecoder As Decoder
用法
Dim instance As Encoding
Dim returnValue As Decoder

returnValue = instance.GetDecoder
public virtual Decoder GetDecoder ()
public:
virtual Decoder^ GetDecoder ()
public Decoder GetDecoder ()
public function GetDecoder () : Decoder

返回值

一个 Decoder,它将已编码的字节序列转换为字符序列。

备注

Decoder.GetChars 方法将连续的字节块转换为连续的字符块,采用的方式类似于该类的 GetChars 方法。但是,Decoder 在调用之间维护状态信息,因此它可以正确地对跨块的字节序列进行解码。Decoder 还保留数据块结尾的尾部字节并将这些尾部字节用在下一次解码操作中。因此,GetDecoderGetEncoder 在网络传输和文件操作中很有用,这是因为这些操作通常处理数据块而不是完整的数据流。

给实现者的说明 默认实现返回一个 Decoder,它只调用当前 EncodingGetCharCountGetChars 方法。必须重写此方法以返回在调用之间维护其状态的 Decoder

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

Encoding 类
Encoding 成员
System.Text 命名空间
Decoder 类
GetChars
GetString
GetCharCount
GetEncoder