为什么不能SqlDataReader类被继承?SqlDataReader

2023-09-06 22:08:38 作者:撒旦の黒名单

SqlDataReader的 该类没有标记密封那么是什么使得它uninheritable?

SqlDataReader class is not marked sealed then what makes it uninheritable?

推荐答案

SqlDataReader的类的构造函数被标记为内部这意味着它只能通过在 System.Data.dll中组装类型的实例化。这也禁止你从它继承,作为基本类型不能被实例化。

The SqlDataReader type's constructor is marked as internal which means it can only be instantiated through types in the System.Data.dll assembly. This also prohibits you from inheriting from it, as the base type cannot be instantiated.