CSharp examples for System.Reflection:PropertyInfo
Get All Properties
using System.Reflection; using System.Linq; using System.Collections.Generic; using System;/*from w w w.j av a 2 s . c om*/ public class Main{ public static IEnumerable<PropertyInfo> GetAllProperties(this Type type) { var typeInfo = type.GetTypeInfo(); var properties = typeInfo.DeclaredProperties; var baseType = typeInfo.BaseType; return baseType == null ? properties : properties.Concat(baseType.GetAllProperties()); } }