GetProperties() problem

  • Thread starter Thread starter Lloyd Dupont
  • Start date Start date
L

Lloyd Dupont

I have a simple class like that:

class Foo
{
int bar;
}

somewhere else in the code I write
Type t = typeof(Foo);
PropertyInfo[] pi = t.GetProperties(BindingFlags.INstance |
BindingFlags.NonPublic);

unfortunately the pi array I get is of length 0 ?!?!
did I miss something ?
 
Lloyd said:
I have a simple class like that:

class Foo
{
int bar;
}

somewhere else in the code I write
Type t = typeof(Foo);
PropertyInfo[] pi = t.GetProperties(BindingFlags.INstance |
BindingFlags.NonPublic);

unfortunately the pi array I get is of length 0 ?!?!
did I miss something ?

No: you have no properties in your class....


(maybe try "GetFields");
 
woaw, so quick.
yep, that was it!

Jochen Kalmbach said:
Lloyd said:
I have a simple class like that:

class Foo
{
int bar;
}

somewhere else in the code I write
Type t = typeof(Foo);
PropertyInfo[] pi = t.GetProperties(BindingFlags.INstance |
BindingFlags.NonPublic);

unfortunately the pi array I get is of length 0 ?!?!
did I miss something ?

No: you have no properties in your class....


(maybe try "GetFields");
 

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