GetConstructors method and Private constructors

D

Doug

I am using reflection to read an assembly and I have a class that has
only a private constructor. However when I use the following method.

Type.GetConstructors(BindFlags.NonPublic);

It does not pick up the private constructor. Instead it reads that
there are no constructors. How do I use this method to determine there
is a private constructor there?
 
V

Vadym Stetsyak

Try this

Type.GetConstructors(BindFlags.NonPublic | BindingFlags.Instance);
 

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

Top