Using LINQ Queries

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 on the data using minimal code. 

In this chapter, we will look at the following topics:

  • Introducing LINQ
  • Understanding the language features that make LINQ possible
  • Understanding LINQ query operators
  • Understanding LINQ behind the scenes
  • Using LINQ to XML

By the end of this chapter, we will have learned how we can use LINQ queries while performing operations on an XML file. We will look at how LINQ queries can help us write, query, and modify XML files.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.248.162