Asked By Peter Duniho
22-Feb-08 11:12 PM
On Fri, 22 Feb 2008 19:53:01 -0800, rodchar =
en =
Just to be clear: if you have an array declared as Label[], there is no =
=
need to cast any element to a Label. Retrieving an element from the arr=
ay =
gives you something that's already a Label type.
Do you mean "set the visibility of each element"? That is, set =
Label.Visible to "true" for each element? Or otherwise perform some =
specific operation on each element?
If so, then no. Somewhere, something needs to loop on the elements.
However, there are of course ways to write code such that this looping i=
s =
done implicitly. For example, you could use the Array.ForEach() method,=
=
which takes as a parameter a method to call for each element. You can =
provide a method that sets the Visible property, and the ForEach() metho=
d =
will call that other method repeatedly, once for each element in the arr=
ay.
Pete