Language Integrated Query introduced in .net framework 3.5. LINQ integrated accessibility of data and query into language. LINQ makes easier to work with data.
Continue...We can also traverse jagged array using LINQ.
Continue...In this tutorial we will discuss how to work with LIST using LINQ. For this example i am going to use the user defined data i.e. class. Create class and add some variable in it. I created the class name TechAltum and add some variable in it which is as follows:-
Continue...Var is data type in C# which holds the anonymous data. When you do not know the return type we can hold data in var. The declaration and definition of var type will be declare in the same line.
Continue...A lambda expression is an anonymous function. Using lambda expression we can create function for delegate and we can also create expression tree type.
Continue...SQL is a structured Query Language. When we need to interact with database using LINQ then we mapped our relational database to object oriented language using LINQ to SQL.
To interact with database we use Datacontext class which is in System.Data.LINQ. This class contains the constructor in which we have to pass the connection string.
Continue...When we insert using LINQ then your table must have primary key. So the table which I was using not contain primary key. So I added one more column name id in the table which is primary and auto generated (used identity). So I have to make following changes in the class which maps my table to object oriented language which is as follows:-
Continue...We use the following code to delete from the database using LINQ:-
Continue...We use the following code to update from the database using LINQ:-
Continue...We use many aggregate functions like sum, count, average, min, and max. In LINQ we can use this function in the following manner:-
Continue...Long count is similar to count as it works same but the only difference between them is that long count returns a 64 bit integer.
Continue...To sort data in LINQ we use orderby in the following manner:-
Continue...We use following set operations in LINQ:-
Continue...When we interact with XML using LINQ then it is known as LINQ to XML
To work with XML in LINQ you have to add a namespace using System.Xml.Linq.
Continue...In my last article I explained how we can create XML file using LINQ. In this article I will discuss how we can traverse this XML file using LINQ.
Continue...Concat method is used to concat two data sources. In my last article I used union method to concat two data sources.
Continue...