c# list of properties from list of objects code example
Example 1: c# get list of all class fields
using System.Reflection;
FieldInfo[] property_infos = typeof(Player).GetFields();
Example 2: c# list of properties from list of objects
List<string> firstNames = people.Select(person => person.FirstName).ToList();
Example 3: c# get list of all class fields
PropertyInfo[] property_infos = typeof(Form1).GetProperties(
BindingFlags.FlattenHierarchy |
BindingFlags.Instance |
BindingFlags.NonPublic |
BindingFlags.Public |
BindingFlags.Static);