How to determine the type of a derived class?
Posted on 2007-11-30
To encapsulate data, I've subclassed several of the winform controls:
TextBox --> EWTextBox;
ComboBox --> EWComboBox;
ListBox --> EWListBox;
For generic handling, I store my derived controls in a list based on their common base class:
EWList<Forms.Control> ewTransactionUtilityControls = new EWList<.Forms.Control>();
Later, when I'm processing the list later, I would like to determine the derived class so I can do special processing according to the derived class type:
foreach( Control control in EWList)
// Figure out whether "control" is an EWTextBox, EWComboBox, EWListBox
How do I do that?