Instantiate object with private constructor

  • Thread starter Thread starter mrrrk
  • Start date Start date
M

mrrrk

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.
 
mrrrk said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top