i am looking to get a list of properties from a derived class i wrote a function that gives my a list of properties. my problem is that i want the list of properties to contain first properties of base class and after properties of derived class how can i do this? now i get first properties in derived and then of base
PropertyInfo[] props = typeof(T).GetProperties();
Dictionary<string, ColumnInfo> _colsDict = new Dictionary<string, ColumnInfo>();
foreach (PropertyInfo prop in props)
{
object[] attrs = prop.GetCustomAttributes(true);
foreach (object attr in attrs)
{
ColumnInfo colInfoAttr = attr as ColumnInfo;
if (colInfoAttr != null)
{
string propName = prop.Name;
_colsDict.Add(propName, colInfoAttr);
}
}
}
Aucun commentaire:
Enregistrer un commentaire