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 3752546
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:15:28+00:00 2026-05-19T09:15:28+00:00

I have the following function: public class InfrStadium { private InfrStadium(int iTeamId) { _teamId

  • 0

I have the following function:

public class InfrStadium
{
    private InfrStadium(int iTeamId)
    {
        _teamId = iTeamId;
        _sectors = InfrStadiumSector.GetTeamSectors(iTeamId);
        ...
    }
    public void Init()
    {
        use(_sectors);
    }
    IList<InfrStadiumSector> _sectors;

some method calls it:

public class InfrStadium
{
    private InfrStadium(int iTeamId, IList<InfrStadiumSector> sectors )
    {
        _teamId = iTeamId;
        _sectors = sectors;
        ...
    }

    public static IList<InfrStadium> GetBestStadium(IQueryable<InfrStadiumSector> sectors)
    {
        IQueryable<InfrStadium> stadiums = from sector in sectors
                                           group sector by sector.TeamId
                                           into team_sectors
                                           select new InfrStadium(team_sectors.Key)
                ;

        return stadiums.ToList();
    }
...
}

Everything is fine here. But there is a problem, inside of ‘InfrStadium’ constructor for each team I need to get sectors information that was already grouped for particular team. So I did such changes:

EDITED: approach with IList<> was added

    public static IList<InfrStadium> GetBestStadium(IQueryable<InfrStadiumSector> sectors)
    {
        IQueryable<InfrStadium> stadiums = from sector in sectors
                                           group sector by sector.TeamId into team_sectors
                                           select new InfrStadium(
                                               team_sectors.Key,
                                               team_sectors.ToList()
                                               )
                ;

        return stadiums.ToList();
    }

And received the following error:

Queryable method call expected. Got ‘team_sectors.ToList()’. Parameter name: info

Why? What is wrong here?

Another approach (actually, not sure if it should work at all):

    private InfrStadium(int iTeamId, IQueryable<InfrStadiumSector> sectors)
    {
        _teamId = iTeamId;
        _qSectors= sectors;
        ...
    }
    public void Init()
    {
        use(_qSectors.ToList());
    }
    IQueryable<InfrStadiumSector> _qSectors;

    public static IList<InfrStadium> GetBestStadium(IQueryable<InfrStadiumSector> sectors)
    {
        IQueryable<InfrStadium> stadiums = from sector in sectors
                                           group sector by sector.TeamId into team_sectors
                                           select new InfrStadium(
                                               team_sectors.Key,
                                               team_sectors.AsQueryable()
                                               )
                ;

        return stadiums.ToList();
    }

My intention is to pass into object constructor required data that will not request DB again.

But in my case I receives an error:

Expression of type 'System.Int32'
cannot be used for parameter of type
'System.Collections.Generic.IEnumerable`1[InfrStadiumSector]' of method
'System.Linq.IQueryable`1[InfrStadiumSector] AsQueryable[InfrStadiumSector](System.Collections.Generic.IEnumerable`1[InfrStadiumSector])'

I don’t understand the error at all. Where is an ‘Expression of type “System.Int32″‘ in my source code?

In my case I’m calling ‘AsQueryable()’ method for type IGrouping<int,InfrStadiumSector>…

Please advise, any thoughts are welcome!

  • 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-19T09:15:29+00:00Added an answer on May 19, 2026 at 9:15 am

    Though Actual reason of error is still non-clear, answers to other similar questions (Linq2Sql: query optimisation, Linq2Sql: query – subquery optimisation) allowed to workaround current question.

    If somebody knows better solution – please advise!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following function in C++ managed (ref) class: public static void Transform(Bitmap^
I have the following object: [Serializable] public class ExampleImage { public int ID {
I have the following class [DataContract] public class A { private List<B> b= new
I have the following structure: public class A { private javax.swing.JLabel fullName; public class
I have the following simple function: public class BaseEntityRepository<TEntity, TId> : IBaseEntityRepository<TEntity, TId> where
I have the following function inside my HomeController class: public class HomeController : Controller
Providing that I have the following on: TeamGamesDao Class: public function listOfTeams() { $select
I have the following classes: class A { public: virtual void myfunc(unsigned char c,
Let's say we have the following method declaration: Public Function MyMethod(ByVal param1 As Integer,
I have the following function: CREATE FUNCTION fGetTransactionStatusLog ( @TransactionID int ) RETURNS varchar(8000)

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.