views:

245

answers:

4

Recently I am using LINQ. But when facing an interview I am unable to explain:

  1. What is LINQ?

  2. Moreover, is DataSet deprecated due to the introduction of LINQ?

From an interview point of view, how should I answer those questions?

+2  A: 

Nice introduction to LINQ Just pick few most important sequences from there for your interview question. As for the second question DataSet's are not deprecated, LINQ is just adding a different way you can work with your data.

RaYell
A: 

LINQ is a syntactic transformation, used for ORM among other things, that allows you to query a data source in a language that the compiler understands. It's advantageous because the compiler can provide syntax checking on the query but it removes the responsibility regarding the specific structure of the query from the user (which can be good and bad).

As to whether or not DataSet is deprecated because of LINQ: that's almost flame-bait. To my knowledge, Microsoft has not deprecated DataSet so my answer would be no. Does that mean DataSets are an inferior feature? It's a debate in itself, IMO.

antik
WRONG. LINQ is not a markup language used for ORM.
Martinho Fernandes
LINQ is a syntactic transformation, that can be used for ORM's, but are definitely not limited to ORM's.
leppie
LINQ-to-SQL is an ORM. LINQ is not an ORM.
Jaco Pretorius
+2  A: 

In addition to what @RaYell said you should have asked your interviewer if they were talking about LINQ or LINQ to SQL when asking if the DataSet was deprecated.

Kane
+7  A: 

LINQ is a set of extensions to the .NET framework that enables language-integrated queries. This basically means that we can use the same type of syntax to query any set of data - whether it be a SQL database, Active Directory, or XML file - we can use the same syntax to execute queries.

The mechanism that LINQ uses to communicate with the different datasources is through providers - you can write your own provider if you wish, but the default providers are LINQ-to-Objects, LINQ-to-SQL and LINQ-to-XML. So again - LINQ allows you to use the same syntax for retrieving data from a SQL database, XML file or in-memory objects.

LINQ does not replace DataSets - in fact, you can use LINQ in conjunction with datasets. The only reason why there is a debate of DataSets vs LINQ is due to LINQ-to-SQL being an ORM. This means that we now have a choice in terms of built-in technologies for communicating with the database - previously datasets would be the default built-in option, now you can also opt for LINQ-to-SQL.

Jaco Pretorius