How to find out if an object is of <type> or a decendant of <type>
- by Vaccano
I have the following code:
foreach (var control in this.Controls)
{
}
I want to do something like control.Hide() in there. But the items in the this.Controls collection are not of type Control (they are Object).
I can't seem to remember the safe way to cast this to call hide if it is really of type Control and do nothing otherwise. (I am a transplanted delphi programmer and I keep thinking something like control is Control.)