Just say you wanted to get a list of properties from a class
var model = new Person();
foreach (var property in model.GetType().GetProperties())
{
Console.WriteLine(property + " " + property.PropertyType.Name);
}
Just say you wanted to get a list of properties from a class
var model = new Person();
foreach (var property in model.GetType().GetProperties())
{
Console.WriteLine(property + " " + property.PropertyType.Name);
}
Comments
Post a Comment