473,498 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Linq - basic simple Answer

Hi all:
after reading different places/sites about linq... I ran into these questions:

1. What framework do we need to run linq ?
(does it depend on what version of visual studio we have?)
how about vs2008?
is it different name space or framework for linq xml or linq sql? (
2. do we need to have references to what linq's dlls. or namespaces?
system core?
3. what name spaces are needed?
4. what is the earliest framework where linq can run?
5. C# vs2008 what else?

thanks for taking the time to clearing this out.

Jul 7 '08 #1
9 2484
On Jul 7, 3:51*pm, raulavi <raul...@discussions.microsoft.comwrote:
after reading different places/sites about linq... I ran into these questions:

1. What framework do we need to run linq ?
That depends on what you mean by LINQ. LINQ to Objects can be run
in .NET 2.0 so long as you have a suitable implementation, such as
LINQBridge (search to find it).
LINQ to XML (and other out-of-process LINQ providers) require
expression trees, which in turn require .NET 3.5.
* *(does it depend on what version of visual studio we have?)
* *how about vs2008?
To be running LINQ "properly" (i.e. with real language integration)
you need to be using C# 3 or VB9, both of which require VS 2008 (or a
text editor with .NET 3.5 installed).
* *is it different name space or framework for linq xml or linq sql? (
2. do we need to have references to what linq's dlls. or namespaces?
* *system core?
You need System.Core for various bits (assuming you want to use the
built-in providers). I can't remember whether the LINQ to XML and LINQ
to SQL classes live - but you could look them up in MSDN.
3. what name spaces are needed?
Again, that depends on the provider you're using. For LINQ to Objects,
you just need System.Linq.
4. what is the earliest framework where linq can run?
See answer to question 1.
*5. C# vs2008 what else?
What do you mean?

Jon
Jul 7 '08 #2
Thanks Jon:
That depends on what you mean by LINQ. LINQ to Objects can be run
in .NET 2.0
lets start with LinQ to Objects. (net.2.0)
then we need .Net3.5 (correct) to support lambdas to expression trees
(i.e., Expression<TDelegate>)
... LINQ to Objects can be run
in .NET 2.0 so long as you have a suitable implementation, such as
LINQBridge (search to find it).
I read about it. very good dll, limited
allowing you to use C# 3.0's extension methods in Framework 2.0.
http://www.albahari.com/nutshell/linqbridge.html

Again, that depends on the provider you're using. For LINQ to Objects,
you just need System.Linq.
I got project properties to target net3.5 , i added the system.core to the
project's references ,and cannot add my using System.Linq (intellisense does
not show it up) and compiler reported as error , Any clue?

5. C# vs2008 what else?
What do you mean?
I meant, anything else to run Linq in C# using visual studio 2008.
but, you already give me the answers, (the clue is that linq is a group of
things
not just a single dll, part of my confusion)
Thanks
(I like the way you anwser everyone's question, you detail answers a little
bit more
Knowing that we want to catch up, thanks for that).


"Jon Skeet [C# MVP]" wrote:
On Jul 7, 3:51 pm, raulavi <raul...@discussions.microsoft.comwrote:
after reading different places/sites about linq... I ran into these questions:

1. What framework do we need to run linq ?

That depends on what you mean by LINQ. LINQ to Objects can be run
in .NET 2.0 so long as you have a suitable implementation, such as
LINQBridge (search to find it).
I read about it. very good dll, very limited
allowing you to use C# 3.0's extension methods in Framework 2.0.

http://www.albahari.com/nutshell/linqbridge.html
LINQ to XML (and other out-of-process LINQ providers) require
expression trees, which in turn require .NET 3.5.
(does it depend on what version of visual studio we have?)
how about vs2008?

To be running LINQ "properly" (i.e. with real language integration)
you need to be using C# 3 or VB9, both of which require VS 2008 (or a
text editor with .NET 3.5 installed).
is it different name space or framework for linq xml or linq sql? (
2. do we need to have references to what linq's dlls. or namespaces?
system core?

You need System.Core for various bits (assuming you want to use the
built-in providers). I can't remember whether the LINQ to XML and LINQ
to SQL classes live - but you could look them up in MSDN.
3. what name spaces are needed?

Again, that depends on the provider you're using. For LINQ to Objects,
you just need System.Linq.
4. what is the earliest framework where linq can run?

See answer to question 1.
5. C# vs2008 what else?

What do you mean?

Jon
Jul 7 '08 #3
raulavi <ra*****@discussions.microsoft.comwrote:
That depends on what you mean by LINQ. LINQ to Objects can be run
in .NET 2.0
lets start with LinQ to Objects. (net.2.0)
then we need .Net3.5 (correct) to support lambdas to expression trees
(i.e., Expression<TDelegate>)
Yes.
... LINQ to Objects can be run
in .NET 2.0 so long as you have a suitable implementation, such as
LINQBridge (search to find it).
I read about it. very good dll, limited
allowing you to use C# 3.0's extension methods in Framework 2.0.
http://www.albahari.com/nutshell/linqbridge.html
It lets you use extension methods (which is the easy bit) *and* it's an
implementation of LINQ to Objects.
Again, that depends on the provider you're using. For LINQ to Objects,
you just need System.Linq.

I got project properties to target net3.5 , i added the system.core to the
project's references ,and cannot add my using System.Linq (intellisense does
not show it up) and compiler reported as error , Any clue?
No idea, I'm afraid - certainly System.Linq.Enumerable is in the
System.Core assembly, for example.

What error are you getting?

If you set the project to target .NET 3.5, I would expect System.Core
to be in the default set of references, by the way.
5. C# vs2008 what else?
What do you mean?
I meant, anything else to run Linq in C# using visual studio 2008.
but, you already give me the answers, (the clue is that linq is a group of
things not just a single dll, part of my confusion)
Yes, it's a fairly vaguely defined term, unfortunately. That's why it's
tricky when someone says "I'm using LINQ to do X" but without making it
clear which "flavour" of LINQ they're using :(
Thanks
(I like the way you anwser everyone's question, you detail answers a little
bit more Knowing that we want to catch up, thanks for that).
My pleasure - glad it helps.

--
Jon Skeet - <sk***@pobox.com>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon_skeet
C# in Depth: http://csharpindepth.com
Jul 7 '08 #4
On Jul 7, 7:07*pm, "Jon Skeet [C# MVP]" <sk...@pobox.comwrote:
LINQ to XML (and other out-of-process LINQ providers) require
expression trees, which in turn require .NET 3.5.
This isn't quite true, as LINQ to XML in particular does not work with
expression trees - all it does is providing a set of "axis" methods
such as Ancestors() or Attributes(), that return IEnumerable of some
XObject-derived type, which can then be queried using LINQ to Objects
as usual. As such, it is quite possible to implement LINQ to XML on
top of .NET 2.0, in the same manner as LINQbridge.
You need System.Core for various bits (assuming you want to use the
built-in providers). I can't remember whether the LINQ to XML and LINQ
to SQL classes live - but you could look them up in MSDN.
It's System.Xml.Linq.dll and System.Data.Linq.dll, respectively - same
as namespaces.

As I recall, System.Xml.Linq is actually added to a new project
references by default if target is set to 3.5.
Jul 7 '08 #5
Pavel Minaev <in****@gmail.comwrote:
LINQ to XML (and other out-of-process LINQ providers) require
expression trees, which in turn require .NET 3.5.

This isn't quite true, as LINQ to XML in particular does not work with
expression trees - all it does is providing a set of "axis" methods
such as Ancestors() or Attributes(), that return IEnumerable of some
XObject-derived type, which can then be queried using LINQ to Objects
as usual. As such, it is quite possible to implement LINQ to XML on
top of .NET 2.0, in the same manner as LINQbridge.
You're right, of course. I don't know what I was thinking. Apologies.
Doh!

The same is true of LINQ to DataSets too.
You need System.Core for various bits (assuming you want to use the
built-in providers). I can't remember whether the LINQ to XML and LINQ
to SQL classes live - but you could look them up in MSDN.

It's System.Xml.Linq.dll and System.Data.Linq.dll, respectively - same
as namespaces.
And LINQ to DataSets is in System.Data.DataSetExtensions.
As I recall, System.Xml.Linq is actually added to a new project
references by default if target is set to 3.5.
Yup - ditto System.Core though, which makes me wonder about raulavi's
follow-up post...

--
Jon Skeet - <sk***@pobox.com>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon_skeet
C# in Depth: http://csharpindepth.com
Jul 7 '08 #6
raulavi wrote:
I got project properties to target net3.5 , i added the system.core
to the project's references ,and cannot add my using System.Linq
(intellisense does not show it up) and compiler reported as error ,
Any clue?
Did the project originally target 2.0 and then you changed it to 3.5?
if so you probably just need to add the assembly reference manually.

Cheers Tim.
Jul 7 '08 #7
Thanks Tim:
You are right, changed proj from 2.0 to 3.5
but, I got to closed IDE and reopened and did the trick. ODD!!
if so you probably just need to add the assembly reference manually.
manually...what do you mean.


"Tim Jarvis" wrote:
raulavi wrote:
I got project properties to target net3.5 , i added the system.core
to the project's references ,and cannot add my using System.Linq
(intellisense does not show it up) and compiler reported as error ,
Any clue?

Did the project originally target 2.0 and then you changed it to 3.5?
if so you probably just need to add the assembly reference manually.

Cheers Tim.
Jul 8 '08 #8
still lot to learn!

Thanks to all.
I got better understanding now.

Jul 8 '08 #9
raulavi wrote:
Thanks Tim:
You are right, changed proj from 2.0 to 3.5
but, I got to closed IDE and reopened and did the trick. ODD!!
Ah cool, glad it got sorted. I didn't know that VS would auto add the
reference to an updated project after a restart, thats cool as it would
have been a minor PITA otherwise.
if so you probably just need to add the assembly reference manually.
manually...what do you mean.
Oh adding an assembly reference manually is just a matter of right
clicking the references entry in the solution explorer and selecting
add reference from the context menu then navigating to the assembly
that you want to add. Though in your case a restart is way better as
you would have been re-adding system assemblies from the later (3.5)
framework directory, much nicer and easier that VS did it for you.

Cheers Tim.

--

Jul 8 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
16345
by: Marc Gravell | last post by:
In Linq, you can apparently get a meaningful body from and expression's .ToString(); random question - does anybody know if linq also includes a parser? It just seemed it might be a handy way to...
3
2877
by: Leo Seccia | last post by:
Hello everyone, I have a c# project with a sql server database. I have a number of lookup tables in my database which I successfully managed to import into my LINQ dataclasses. eg. Table:...
2
1572
by: AAAAA | last post by:
Hi guys I have a one question, is Linq to Sql good in pefornace? is better that traditional method? ismore than speed?? or is same? Thanks.. Regards Cesar
14
3649
by: thj | last post by:
Hi, I was wondering what you guys are using and why? LINQ to SQL or NHibernate? Thanks in advance, Tommy
3
1181
by: Duncan A. McRae | last post by:
I am trying to find a simple answer to, "if I use LINQ against tables, must I give the webuser datareader/datawriter permissions in SQL Server?". I see the question asked repeatedly, but instead...
2
2379
by: shapper | last post by:
Hello, I have the following Linq query: List<PostsTaginsert = (from t in (from t in database.Tags join p in paper.Tags on t.Name equals p.Name select t).ToList() select new PostsTag {
5
2585
by: Mythran | last post by:
Consider the following: List<intints = new List<int>(); for (int i = 0; i < 20; i++) { ints.Add(i); } // EXAMPLE 1 var strings = from i in ints
3
10897
by: bob laughland | last post by:
Hi All, I am using a combination of LINQ to SQL and bulk insert. In the process of performing 'one unit of work' I will be doing things like reading, and deleting records using LINQ to SQL and...
0
7121
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6993
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7197
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5456
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4899
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1411
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.