D
Daniel
I have to read the property names of the items of an IList to show them in a
DataGridView.
This is no problem if the passed IList contains items, so I can select the
first item to get it's type and then get it's properties, like:
void CreateDataGridViewColumns( IList list )
{
foreach( PropertyInfo pi in list[ 0 ].GetType().GetProperties() )
{
DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn();
column.Name = pi.Name
dataGridView.Add( column );
}
}
But how can I get the type of the IList items if tht IList is empty?
Thanks in advance
Daniel
DataGridView.
This is no problem if the passed IList contains items, so I can select the
first item to get it's type and then get it's properties, like:
void CreateDataGridViewColumns( IList list )
{
foreach( PropertyInfo pi in list[ 0 ].GetType().GetProperties() )
{
DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn();
column.Name = pi.Name
dataGridView.Add( column );
}
}
But how can I get the type of the IList items if tht IList is empty?
Thanks in advance
Daniel