1)What is LINQ ?
The full form of LINQ is language integrated query, that means the query can be written integrated with programming language. LINQ is a platform of standard query operator that is integrated with.Net 3.5 and upper version. LINQ works with C#,VB.Net and other .Net languages.LINQ uniform syntax work with different data source like
DataSet , XML , SQL , Collection ect.
2)What is Lambda Expression ?
Lambda expression is an anonymous function or delegate that create expression of query.Lambda expression uses symbol '=>'.Left side of this symbol is Input and right side is statement or expression. Here is the example of Lambda expression
Input=> expression or statement
3)How LINQ is beneficial over the Stored procedure ?
debug :LINQ is language integrated, that means you can debug your query during the debugging of source code. Store procedure does not comes under language , Store procedure cannot be debug form source code.
Types safe : LINQ is types safe. Compile time checking are done during the compilation of program. Stored procedure cannot be check during the compile time , that may result run time exceptions.
4)Why select statement comes after form statement in LINQ query ?
.Net programming language like C @,VB.Net allow variable to declare first , then only you can use the variables. The form statement define the object of LINQ, now you can write select statement in your query.
Here is a example of a select statement
var query = from s in students
The extension of file is "dbml". You need to add LINQ to SQL class first ,the filename will be your file name with extension "dbml". Now you can query over the "dbml" file.
6)What is DLINQ ?
It is nothing but LINQ to SQL.Namespace is used for this purpose is System.data.dlinq.
7)What is the benefit of using LINQ over the DataSet ?
LINQ is strongly typed, compile time checking is done during compilation.error of querying during run time is minimized .
DataSet is filled with data from database containing one or multiple tables. LINQ query on DataSet by converting as Enumerable(IEnumerable) and retrieve the data. No need to connect in database to get the required query result, you can directly query on DataSet by writing language integrated query which reduces effort and line of source code ,gives more accuracy.Here is an example of LINQ over DataSet.
var res = from exp in ds.Tables[0].AsEnumerable()
8)What is query expression ?
query expression is a combination of queries instruction which is executed one by one to retrieve data from data source . For example filter ,short, uppercase, group by apply to the data source as query expression. Query expression Syntax are similar to the SQL syntax. Here is the syntax of a query expression.
9)What are the basic step to execute LINQ query ?
2)First obtain a data source, the data source maybe collections, maybe LINQ to SQL file, maybe XML file.
3)Create a query.
4)Execute a query.
Below is the example of steps
10)In which statement LINQ to SQL Query is executed ?
C Sharp :foreach
VB.Net : For Each
11)What is the difference between take and skip method of LINQ ?
"take" and "skip" method that provide some additional functionality on LINQ query.
"take" method return the element of an collection from starting to position number supply to the take method.
int[] marks = { 10, 20, 30, 40, 50, 60 };
"skip" method skip the number of element that supplied and and return the rest of the element from the collection.
int[] marks = { 10, 20, 30, 40, 50, 60 };
11)Which interface implement the standard query operator ?
Ans : IEnumerable & IQueryable
12)what are the different implementation of LINQ ?
There are various type of implementation of LINQ. LINQ can work with different kind of object and collections to provide faster and smoother way to return desired result.
The full form of LINQ is language integrated query, that means the query can be written integrated with programming language. LINQ is a platform of standard query operator that is integrated with.Net 3.5 and upper version. LINQ works with C#,VB.Net and other .Net languages.LINQ uniform syntax work with different data source like
DataSet , XML , SQL , Collection ect.
2)What is Lambda Expression ?
Lambda expression is an anonymous function or delegate that create expression of query.Lambda expression uses symbol '=>'.Left side of this symbol is Input and right side is statement or expression. Here is the example of Lambda expression
Input=> expression or statement
3)How LINQ is beneficial over the Stored procedure ?
debug :LINQ is language integrated, that means you can debug your query during the debugging of source code. Store procedure does not comes under language , Store procedure cannot be debug form source code.
Types safe : LINQ is types safe. Compile time checking are done during the compilation of program. Stored procedure cannot be check during the compile time , that may result run time exceptions.
4)Why select statement comes after form statement in LINQ query ?
.Net programming language like C @,VB.Net allow variable to declare first , then only you can use the variables. The form statement define the object of LINQ, now you can write select statement in your query.
Here is a example of a select statement
var query = from s in students
order by
s.name,
s.age
select
s;
5)What is the extension of file , LINQ to SQL is used ?The extension of file is "dbml". You need to add LINQ to SQL class first ,the filename will be your file name with extension "dbml". Now you can query over the "dbml" file.
6)What is DLINQ ?
It is nothing but LINQ to SQL.Namespace is used for this purpose is System.data.dlinq.
7)What is the benefit of using LINQ over the DataSet ?
LINQ is strongly typed, compile time checking is done during compilation.error of querying during run time is minimized .
DataSet is filled with data from database containing one or multiple tables. LINQ query on DataSet by converting as Enumerable(IEnumerable
var res = from exp in ds.Tables[0].AsEnumerable()
where
exp.Field<string>("Name")
== "John2"
select
new
{
MyName
= exp.Field<string>("Name"),
MyRoll
= exp.Field<string>("RollNumber"),
};
8)What is query expression ?
query expression is a combination of queries instruction which is executed one by one to retrieve data from data source . For example filter ,short, uppercase, group by apply to the data source as query expression. Query expression Syntax are similar to the SQL syntax. Here is the syntax of a query expression.
IEnumerable
Query =
from
score in myData
where
score > 85
orderby
score descending
select
score;
9)What are the basic step to execute LINQ query ?
2)First obtain a data source, the data source maybe collections, maybe LINQ to SQL file, maybe XML file.
3)Create a query.
4)Execute a query.
Below is the example of steps
var
res
= from
exp
in
ds.Tables[0].AsEnumerable()
where
exp.Field<string>("Name")
== "John2"
select
new
{
MyName
= exp.Field<string>("Name"),
MyRoll
= exp.Field<string>("RollNumber"),
};
foreach
(var
q
in
res)
{
Console.WriteLine("Name
= {0} , RollNumber = {1} ",
q.MyName,
q.MyRoll);
}
10)In which statement LINQ to SQL Query is executed ?
C Sharp :foreach
VB.Net : For Each
11)What is the difference between take and skip method of LINQ ?
"take" and "skip" method that provide some additional functionality on LINQ query.
"take" method return the element of an collection from starting to position number supply to the take method.
int[] marks = { 10, 20, 30, 40, 50, 60 };
var
newList = marks.Take(2);
"skip" method skip the number of element that supplied and and return the rest of the element from the collection.
int[] marks = { 10, 20, 30, 40, 50, 60 };
var
newList = marks.Skip(2);
11)Which interface implement the standard query operator ?
Ans : IEnumerable
12)what are the different implementation of LINQ ?
There are various type of implementation of LINQ. LINQ can work with different kind of object and collections to provide faster and smoother way to return desired result.
- LINQ to SQL : LINQ to SQL work on relational database . This facility available from.Net framework 3.5 and upper version.
- LINQ to DataSet : LINQ to DataSet convert datatable as IEnumerable. Filter , sort with standard of query is possible.
- LINQ to XML : LINQ query on XML document.XML document is used for storing data and later retrive from it. You can query on XML data.
- LINQ to Object : LINQ on collection object.
No comments:
Post a Comment