If I enter the code below, I get an error. Basically, foreach will break when it encounters a control that is not a label.
foreach (Label currControl in this.Controls()) {
...
}
I need to do something like this.
foreach (Control currControl in this.Controls()) {
if(typeof(Label).Equals(currControl.GetType())){
...
}
}
can anyone think of a better way to do this without me to check the type? Can I somehow make foreach skip objects that are not shortcuts?
source
share