In .NET, we often need to query data from different sources, such as XML, SQL, and web services. In earlier versions of .NET, we performed these operations using simple strings. The main issue with this approach is that it lacks any IntelliSense and is quite cumbersome in implementation. These queries also differ from one another as to the source from which we are querying the data, thereby increasing the code complexity.
To overcome these issues, LINQ was firstly introduced in .NET 3.5. Compared to conventional data access methods, LINQ introduces an easy and consistent approach for the querying and modification of data across different types of data sources such as XML and even in-memory data structures such as arrays. In LINQ, we query data using a query expression. The query expression enables us to perform filtering, ordering, and grouping of operations...