public static void CreatePropertyRows(this TableLayoutPanel panel, UserProfile profile) { foreach (PropertyInfo pi in profile.Details.GetType().GetProperties()) { panel.CreatePropertyRow(pi); } foreach (PropertyInfo pi in profile.GetType().GetProperties()) { panel.CreatePropertyRow(pi); } }