How will I know if an object instance is a property or a sub property of another object instance?
for example I have this class structure:
public class Car
{
public Manufacturer Manufacturer {get;set;}
}
public class Manufacturer
{
public List<Supplier> {get;set;}
}
public class Supplier
{
string SupplierName {get;set;}
}
And I only have two instances, the Car and the SupplierName; Using PropertyInfo in Reflection, How can I Implement a method such as
bool IsPropertyOrSubPropertyOf(object ObjectInstance, object TargetObejectInstance)
used as
IsPropertyOrSubPropertyOf(SupplierNameInstance, CarInstance)
this method will return true if the CarInstance's Property Manufacturer has a Supplier that has a SupplierName SupplierNameInstance