public class Generic_Table<T> : Table { ...// in ctor type = this.GetType().GetGenericArguments()[0]; // type of T BuildColumns(type); private void BuildColumns(Type type) { PropertyInfo[] properties = type.GetProperties(); Columns = new KeyValuePair<string, Type>[properties.Count()]; int i = 0; foreach (PropertyInfo property in properties) { Columns[i++] = new KeyValuePair<string, Type>(property.Name, property.PropertyType); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)