471,354 Members | 1,212 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

GetConstructor method and private constructors

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?

Dec 9 '05 #1
2 7235
Doug wrote:
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?


You need GetConstructors (BindingFlags.NonPublic |
BindingFlags.Instance);

Jon

Dec 9 '05 #2
Thank you, that was exactly what I was lookin for!

Dec 9 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Joshua Coady | last post: by
6 posts views Thread by Gonçalo Rodrigues | last post: by
10 posts views Thread by Mark | last post: by
3 posts views Thread by swengtoo | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.