For a GetListType
function see this answer. To get the properties of the list for data-binding purposes, you should really use the component-model (for compatibility) - i.e.
PropertyDescriptorCollection props = TypeDescriptor.GetProperties(type);
Then look at each PropertyDescriptor
, using GetValue
/ Converter
etc. Your list code will generally have to work against the non-generic IList
; something like:
IList list = ...
object obj = list[rowIndex];
// then for any given "prop"
object val = prop.GetValue(obj);
string displayText = prop.Converter.ConvertToString(val);
However, if you wanted to be "complete" you'd also need to look at IListSource
and ITypedList