c# syntax and Linq, IQueryable

Posted by hdiver on Stack Overflow See other posts from Stack Overflow or by hdiver
Published on 2010-05-18T11:43:55Z Indexed on 2010/05/18 11:50 UTC
Read the original article Hit count: 267

Filed under:
|
|

Hello. This is a question about the SYNTAX of c# and NOT about how we call/use IQueryable

Can someone please explain to me:

We have this declaration (System.Linq):

public static double Average<TSource>(this IQueryable<TSource> source,
                                      Expression<Func<TSource, int>> selector)

and to call the Average

double average = fruits.AsQueryable().Average(s => s.Length);

I understand how to call the Average and all the similar static method of IQueryable but I don’t understand the syntax of the declaration.

public static double Average<TSource>(this IQueryable<TSource> source,
                                      Expression<Func<TSource, int>> selector)

What does the <TSource> mean in Average<TSource>( and also the this IQueryable<TSource> source.

since only one parameter passes when we call it and the actual lamda expression (s => s.Length);

Thanks in advance.

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ