There is an need to appreciate how C# has made SqlDataReader class Non Inheritable and Non Instantiable.
Namespace: System.Data.SqlClient
SqlDataReader class header :
public class SqlDataReader : System.Data.Common.DbDataReader, IDisposable, System.Data.Common.IDbColumnSchemaGenerator{
}
Question 1: The class seen is public.
Since the class is public :: So why can't it be inherited.
Question 2: Constructor is not Private : Infact on seeing the definition of SqlDataReader : no constructor was seen :: So i guess the Default constructor that C# will label to it to be default would be a Public one which happens when no constructor is found :: So despite, supposedly, having a Public constructor why should the Instantiation not be possible.
Besides I can't find the constructor to be "internal" as was answered and accepted in this question link : why cant SqlDataReader class be inherited?
Would be highly appreciative if the point of error in the above thinking can be highlighted.
System.Datadll, but cannot be instantiated from outside it, meaning you also cannot inherit it as any class inheriting from it cannot instantiate its base classinternal SqlDataReader(SqlCommand command, CommandBehavior behavior) { ... }. How did you examine the "sourcecode"? Probably with some tool that just decompiles an assembly. However that does not neccessarily give youe the actual code.