PropertyDescriptorCollection could not be found

I have a licensed version of LINQPad 4. I am trying to reference PropertyDescriptorCollection and have added the namespace System.ComponentModel and System.ComponentModel.TypeConverter but am getting the errors:
"The type or namespace name 'PropertyDescriptorCollection' could not be found".
"The name 'TypeDescriptor' does not exist in the current context".

Code sample:

public DataTable ConvertToDataTable(IList data)
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(typeof(T));
DataTable table = new DataTable();
foreach (PropertyDescriptor prop in properties)
table.Columns.Add(prop.Name, Nullable.GetUnderlyingType(prop.PropertyType) ?? prop.PropertyType);
foreach (T item in data)
DataRow row = table.NewRow();
foreach (PropertyDescriptor prop in properties)
row[prop.Name] = prop.GetValue(item) ?? DBNull.Value;
return table;


Sign In or Register to comment.