.NET中的Object类
- 代码中的解释:
// Supports all classes in the .NET class hierarchy and provides low-level services
// to derived classes. This is the ultimate base class of all .NET classes; it is
// the root of the type hierarchy.
可以看出,Object类是所有类的基类,而值类型和引用类型的存储方式不同,C#允许值类型的值和引用类型之间转换,称之为拆箱和装箱。
- Object类中的方法
值得注意的一个是ToString方法,基类中存在此方法,故所有的类中都有此方法,可能会重写此方法,此方法经常被调用。


浙公网安备 33010602011771号