hi there
how to send a list of specific class to such method:
- public static DataTable SetPropertyToDataTable<T>(T dataList,Type _class) where T : class
- {
- Dictionary<string, object> columns = new Dictionary<string, object>();
-
- var properties =_class.GetProperties();
-
- foreach (var item in dataList)
- foreach (var property in properties)
- {
- var name = property.Name;
- var value = property.GetValue(item, null);
-
- if(!columns.ContainsKey(name))
- columns.Add(name, value);
- }
-
- return ImportPropertyAndValues(columns);
- }
I mean T datalist