foreach (var item in Assembly.GetExecutingAssembly().GetTypes()
.Where(x => x.BaseType == typeof(Item)))
{
comboBox1.Items.Add(item);
}
comboBox1.DisplayMember = "Name";
Can this be modified so that the list will include all classes that are derived from 'Item' even if they are two or more times removed? (ie: x.BaseType.BaseType == typeof(Item) etc.)
Also, could it be done to filter out all abstract classes?
Aucun commentaire:
Enregistrer un commentaire