what is LINQ?
Based on this source
LINQ defines a set of method names (called standard query operators, or standard sequence operators), along with translation rules from so-called query expressions to expressions using these method names, lambda expressions and anonymous types. These can, for example, be used to project and filter data in arrays, enumerable classes, XML (LINQ to XML), relational database, and third party data sources. Other uses, which utilize query expressions as a general framework for readably composing arbitrary computations, include the construction of event handlers or monadic parsers.
of course… Hahahaaa
Okey i’ll try to make an example about Linq to be used to project and filter data in arrays.
I have an array that has several values
What will you do if you want to sort them ascending?
Using bubble sort algorithm? selection sort? insertion sort or anything else?
Yes you can do with that but it will takes your time
Remember, time is money, hhahaa 😀
So, what we gonna do?
Whatever the algorithm that used on it, we can use Linq to make it comestrue, hhheehee
As you can see on picture above..
var outputArray = from ouput in array
Is a Linq which is try to make query to retrieve values in array. But it is not execute and get the value until we ‘force’ it.
I use Foreach looping to retrieve it’s values.
foreach (int outs in outputArray)