I'm trying to display an object into a DataGridView using Reflection
so far everything works smootly but the problem is that some of the object's properties are Lists. How can I adapt my DataGridView to show a list?
public void SetDataSource(PluginBase plugin)
{
dgvProperties.Rows.Clear();
List<DataGridViewRow> rows = new List<DataGridViewRow>();
foreach (PropertyInfo info in typeof(PluginBase).GetProperties(BindingFlags.Public|BindingFlags.Instance))
{
object value = plugin.GetType().GetProperty(info.Name).GetValue(plugin, null);
object[] o = new object[2];
o[0] = info.Name;
o[1] = value;
DataGridViewRow dgvr = new DataGridViewRow();
dgvr.CreateCells(dgvProperties, o);
rows.Add(dgvr);
}
dgvProperties.Rows.AddRange(rows.ToArray());
}