public static void Main()
var outer = new OuterProduct();
CheckTheProperties(outer);
public static void CheckTheProperties(object test)
var type = test.GetType();
foreach (PropertyInfo property in type.GetProperties())
if (property.PropertyType == typeof(InnerProduct))
Console.WriteLine("Inner Product - " + property.Name);
Console.WriteLine("Nested? " + property.PropertyType.IsNested);
public class OuterProduct
public string ProductName { get; set; }
public int AmountSold { get; set; }
public InnerProduct InnerProduct { get; set; }
public class InnerProduct
public string ProductNameInner { get; set; }
public int AmountSoldInner { get; set; }