I have a large class with many nested subclasses of different types as follows:
class BigFooClass
{
// Classes
Foo InnerFoo {get; set;}
Bar InnerBar {get; set;}
Oof InnerOof {get; set;}
Rab InnerRab {get; set;}
// Simple Properties
Decimal OuterDecimal {get; set;}
Long OuterLong {get; set;}
{
Each of these inner classes are defined as follows:
class Foo
{
Decimal DecimalProp {get; set;}
Long LongProp {get; set;}
}
class Bar
{
Decimal Decimal Prop {get; set;}
Long LongProp {get; set;}
} etc...
I want to get a list of ALL Decimal or Long properties together with their container types as follows:
BigFooClass.OuterDecimal is type of Decimal
BigFooClass.OuterLong is type of Long
Foo.OuterDecimal is type of Decimal
Foo.OuterLong is type of Long
Bar.OuterDecimal is type of Decimal
Bar.OuterLong is type of Long
I can get to the first level but cannot find how to reflect the type from a PropertyInfo, which may not be the correct way to do it.
Can anyone show me how to do it please?
Brian