What are the three main components of LINQ or Language INtegrated Query?
1. Standard Query Operators
2. Language Extensions
3. LINQ Providers
How are Standard Query Operators implemented in LINQ?
Standard Query Operators are implemented as extension methods in .NET Framework. These Standard Query Operators can be used to work with any collection of objects that implements the IEnumerable interface. A class that inherits from the IEnumerable interface must provide an enumerator for iterating over a collection of a specific type. All arrays implement IEnumerable. Also, most of the generic collection classes implement IEnumerable interface.
How are Standard Query Operators useful in LINQ?
Standard Query Operators in LINQ can be used for working with collections for any of the following and more.
1. Get total count of elements in a collection.2. Order the results of a collection.
3. Grouping.
4. Computing average.
5. Joining two collections based on matching keys.
6. Filter the results
List the important language extensions made in C# to make LINQ a reality?
1. Implicitly Typed Variables
2. Anonymous Types
3. Object Initializers
4. Lambda Expressions
What is the purpose of LINQ Providers in LINQ?
LINQ Providers are a set of classes that takes a LINQ query and dynamically generates a method that executes an equivalent query against a specific data source.
What are the four LINQ Providers that .NET Framework ships?
1. LINQ to Objects - Executes a LINQ query against a collection of objects
2. LINQ to XML - Executes an XPATH query against XML documents
3. LINQ to SQL - Executes LINQ queries against Microsoft SQL Server.
4. LINQ to DataSets - Executes LINQ queries against ADO.NET DataSets.
Write a program using LINQ to find the sum of first 5 prime numbers?
I went for an interview and I faced the same questions which you mentioned here, but I could answer only few of them. Well thanks for sharing such knowledgeable post. I save this and will be prepare for next one interview.
ReplyDeletewhen to prefer Linq and when to prefer stored procedure?
ReplyDeletewhen should i use temp table ?
ReplyDeletewhen should i use table variable?
when should i use CTE?
when should i use Derived Tables?
Thanks a lot for giving such a nice explanations for most wanted questions
ReplyDelete3. LINQ to SQL - Executes LINQ queries against Microsoft SQL Server.
ReplyDeleteit does not executes they query but it translates the QUERY to T-SQL format and then ADO provider executes it.
Does Linq is faster than ADO.NET ? Performance criteria while using Linq?
ReplyDeletedifference b/w clone and copy
ReplyDelete