Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between System.Linq and System.Data.Linq?

Tags:

c#

.net

linq

I was having troubles earlier while trying to declare a ChangeAction parameter in a method, with the IDE saying I might be missing a Namespace.

So I right click it and Resolve it and find that System.Data.Linq has been added and now everything is fine.

What is the difference between these two namespaces?

like image 422
Sergio Tapia Avatar asked Jun 11 '10 01:06

Sergio Tapia


People also ask

What is System data LINQ?

LINQ to SQL is a technology that provides a run-time infrastructure for managing relational data as objects.

How does LINQ any work?

The C# Linq Any Operator is used to check whether at least one of the elements of a data source satisfies a given condition or not. If any of the elements satisfy the given condition, then it returns true else return false. It is also used to check whether a collection contains some data or not.


4 Answers

As I understand it, System.Linq is about the overall Linq library -- it applies to all data types like Lists and such.

System.Data.Linq is about databases (aka Linq to SQL), which includes tracking changes (ChangeAction).

like image 98
Matt Sherman Avatar answered Oct 09 '22 17:10

Matt Sherman


I believe System.Linq is LINQ-OBJECTS specific (IEnumerable, IQueryable, etc)

Whilst System.Data.Linq is LINQ-SQL specific (DataContext, etc)

like image 31
RPM1984 Avatar answered Oct 09 '22 17:10

RPM1984


As described here:

http://msdn.microsoft.com/en-us/library/system.data.linq.aspx

System.Data.Linq is for accessing relational data

like image 41
kamahl Avatar answered Oct 09 '22 16:10

kamahl


To my understanding, System.Linq is generic-level implementation which relies on IEnumerable whereas System.Data.Linq is provider-specific (LINQ to SQL) which relies on IQueryable.

like image 35
Thurein Avatar answered Oct 09 '22 16:10

Thurein