ASCIIEncoding与Encoding之间的区别 [英] Difference Between ASCIIEncoding and Encoding

查看:600
本文介绍了ASCIIEncoding与Encoding之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道Encoding可以用于初始化对象来执行任何类型的编码,ASCII,Unicode,UTF-8等。
在我看来,所有这些都足以执行任何类型的编码,然后需要使用ASCIIEncoding?

解决方案

Encoding 除了作为所有编码器的基类之外,还为命名的子类提供静态属性访问器。



Encoding.ASCII 返回一个 ASCIIEncoding 的实例,反过来,子类 Encoding 并传递代码页 0x4e9f US-ASCII )到基础构造函数。


I understand that Encoding can be used to initialize object to perform any type of Encoding, ASCII, Unicode, UTF-8 etc. It appears to me that all these are sufficient for performing any kind of encoding, then what is the need for ASCIIEncoding?

解决方案

The Encoding class, in addition to being the base class of all encoders, provides static property accessors to the named subclasses.

Encoding.ASCII returns an instance of ASCIIEncoding which, in turn, subclasses Encoding and passes the codepage 0x4e9f (US-ASCII) to the base constructor.

这篇关于ASCIIEncoding与Encoding之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆