Q:

c# syntax and Linq, IQueryable

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 lambda expression (s => s.Length);
Thanks in advance. 

A:

The <TSource> part declares the generic type parameters of the method - basically what kind of element the sequence contains.  You should definitely understand generics before you get too far into LINQ. 
Then,
this IQueryable<TSource> source

indicates the first parameter of the method:

this indicates that it's an extension method
IQueryable<TSource> indicates the type of the parameter
source is the name of the parameter

The fact that it's an extension method is probably what's confusing you.  When you call
query. Average(s => s.Length)

that is converted by the compiler into
Queryable. Average(query, s => s.Length)

