I’ve done a little bit of LINQ but I almost exclusively return some elements from a collection based on some criteria. Now I’m trying to do something similar; let’s say I have 50 winForm Controls in a collection – I want to set the .Visible property = True based on the controls name.
How would I do that? Below is my failed attempt.
myControls.AsEnumerable.Select( Function (myControl as Control) ( myControl.Visible = (myControl.Name <> "Hidden")) )
It compiles and even executes but does nothing.
Use a foreach