Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 793071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:05:37+00:00 2026-05-14T22:05:37+00:00

This is a question about the SYNTAX of c# and NOT about how we

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T22:05:38+00:00Added an answer on May 14, 2026 at 10:05 pm

    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)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to set GridView.DataKeyNames (This is really a question about the syntax for
This morning I asked a pretty mundane question about my JS syntax, and someone
I have already asked a question about syntax highlighting, but this seems (to me)
This is related to this question I asked earlier about syntax highlighting user-defined blocks
EDIT: This question is about finding definitive reference to MySQL syntax on SELECT modifying
This question about Timers for windows services got me thinking: Say I have (and
I've this question about pass some instances by ref or not: here is my
I have seen this question about deploying to WebSphere using the WAS ant tasks.
I can't find an answer to this question anywhere so I'm hoping someone can
I'm one day into learning JQuery and have a question about the octothorpe syntax.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.