It is not possible to create an instance of a
System.Data.SqlClient.SqlDataReader because it's constructor is Private.
But somehow the ExecuteReader method of SqlCommand manages to create a
reader object.

How is this acheived because I want to emulate this sort of behaviour?

Thanks in advance.

Re: Instantiate object with private constructor by Jon

Jon
Fri May 07 02:36:55 CDT 2004

mrrrk <abc@xyz.xyz> wrote:
> It is not possible to create an instance of a
> System.Data.SqlClient.SqlDataReader because it's constructor is Private.
> But somehow the ExecuteReader method of SqlCommand manages to create a
> reader object.
>
> How is this acheived because I want to emulate this sort of behaviour?

The constructor isn't private - it's internal.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too