Let say I have classes hierarchy like
public class A
{
public int AMember { get; set; }
}
public class B
{
public int BMember { get; set; }
public virtual A AasMember { get; set; }
}
public static class OrderByUtility
{
public static bool PropertyExists<T>(string propertyName)
{
return typeof(T).GetProperty(propertyName, BindingFlags.IgnoreCase |
BindingFlags.Public) != null;
}
}
From main class whenever I use this Utility
OrderByUtility.PropertyExists BClass>("BMember");
This works fine and returns TRUE. But whenever I use
OrderByUtility.PropertyExists BClass> ("AMember"); returns False
I want same PropertyExist function work for all Composed Object. Please suggest resolving this issue. Thanks