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");
 
Back
Top