> I want to know advantages on LINQ
That's a very vague question.
For one, you got a simplified syntax for querying enumerable data
sources of various types.

Signature
Lasse Vågsæther Karlsen
mailto:lasse@vkarlsen.no
http://presentationmode.blogspot.com/
As Lasse says, that is a vague question, but there are some definite
advantages that can be pointed to.
The biggest one is that you can now structure queries in your code which
are compile-time checked, regardless of the back end data source (so if you
are using LINQ-to-SQL, then you are going to get compile-time checking on
your queries, instead of seeing it at runtime with a query string).
If you are using LINQ-to-Objects, then a big advantage is that you can
create complex queries in a simple manner which were previously very
difficult.
For example, say you want to get all the declared methods on a type
which are generic which you want to run some processing on. In .NET 2.0,
you would do this:
// Get the methods. Assume type is of type Type.
IEnumerable<MethodInfo> methods = type.GetMethods();
// Cycle.
foreach (MethodInfo methodInfo in methods)
{
// Check to see if the method is generic.
if (methodInfo.IsGeneric)
{
// Continue processing.
}
}
In .NET 3.5/C# 3.0, you can do this:
// Generate the query.
IEnumerable<MethodInfo> methods =
from methodInfo in type.GetMethods()
where methodInfo.IsGeneric
select methodInfo;
// Process the methods.
foreach (MethodInfo methodInfo in methods)
{
// Process.
}
Subsequently, you could also do this, which is even simpler, in my
opinion:
// Get the methods.
IEnumerable<MethodInfo> methods = type.GetMethods().Where(methodInfo =>
methodInfo.IsGeneric);
// Process.
foreach (MethodInfo methodInfo in methods)
{
// Process.
}
Two big wins, IMO.

Signature
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
>I want to know advantages on LINQ
Mythran - 09 Jan 2008 16:34 GMT
> In .NET 3.5/C# 3.0, you can do this:
>
[quoted text clipped - 24 lines]
>
> Two big wins, IMO.
Man, I wish I was working for a company that allowed me to use .Net
3.5/C#3.0. Currently, we are still using the 1.1 framework and VB.Net...(I
know C# and VB.Net but they won't allow us to use C#).
Sucks for me!
:)
Mythran
Michael Starberg - 11 Jan 2008 15:26 GMT
> Sucks for me!
>
> :)
>
> Mythran
GROUPHUG!
I feel so sorry for you...
Maybe you should quit your job and find a better employer?
- Michael Starberg