I have a parent class to be inherited from:
public class Item {}
public class Base {
public List<Item> Items;
public void Register() {
// How to get all members of type Item and its deribed into Items list?
}
}
public class Shell : Base {
Item A = new Item();
Item B;
Item C;
public Shell(Item c) {
C = c;
B = new Item();
}
}
I want to call Register from external code. When Register
is called on say Shell
instance its Items
list shall get refrences to A
, B
, C
, yet not require Shell author to add any code for it. How to do such thing in C#?
Aucun commentaire:
Enregistrer un commentaire