FAQ Database Discussion Community


PropertyInfo.GetValue(object) fails with IEnumerable [C#, Reflection]

c#,reflection,ienumerable,var-dump,propertyinfo
I have the following problem: I am currently writing the c# equivalent of PHP's var_dump-method. It works perfectly with 'simple' classes and structures (and even with arrays). My only problem is when it comes to other IEnumerable<T>, like List<T> etc: The debugger is throwing an TargetParameterCountException. My code looks as...

Propertyinfo get value non static value requires target

c#,reflection,propertyinfo
Im trying to reflect some data from my properties and im having a hard time trying to figure out why im getting the error "non static value requires target" I have tried passing values into getvalue with no success. if i step through the code the properties are there, do...

Reflection: Get all subproperties

c#,reflection,propertyinfo
I have a List that contains objects and each of these objects contains a lot of properties of several types, and each of these properties contains subproperties aswell. I need to get all the properties via Reflection and store them in one PropertyInfo[] ... Is this even possible with reflection?...