Using Linq And Lambda Functions
How to use LINQ, Anonymous Functions, and Lambda Expressions
How it works
You may ask: “ what the heck is the “=>” ?
That’s part of the lambda expression. Here’s what happens. Imagine we have a collection of 6 textboxes.
0x0 {Textbox}
0x1 {Textbox}
0x2 {Textbox}
0x3 {Textbox}
0x4 {Textbox}
0x5 {Textbox}
0x6 {Textbox}
The lambda expression ( x => x.Text == “” ) expands to something like this:
Now, the Children.OfType<TextBox>().Where()
function
calls the function above on every textbox in the collection.