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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:37:34+00:00 2026-06-16T02:37:34+00:00

I have a particular LINQ query that is doing a group by an anonymous

  • 0

I have a particular LINQ query that is doing a group by an anonymous type and then selecting into an object via projection. The query works fine when selecting in to the object. I am now trying to change the usage of the query to go in to a DTO that contains all the properties being projected to the object, however when I switch the types from the Object to the DTO, the query starts giving me an error that the IQueryable.Select has invalid arguments.

IQueryable<type> result = from o in blah where some_conditions
                          orderby o.Name
                          group o by new {o.Value1, o.Value2, o.Value3} into groupedO
                          select new type 
                          {
                               Value1=groupedO.Key.value1,
                               Value2=groupedO.Key.value2,
                               Value3=groupedO.Key.value3
                          }

Works fine when “type” is my original object but fails when I make it my DTO that has properties Value1,Value2 and Value3 (of the appropriate types).

I realize this probably isn’t enough information to find the problem, but I’d also accept any pointers as to a direction to look for what could cause the issue. I can’t tell what could possibly be different. Also, if I remove the group, the query works fine, so it is something specific to the anonymous type in the group.

The exact error is

System.Linq.IQueryable<System.Linq.IGrouping<AnonymousType#1,someDalClass>>' does not contain a definition for 'Select' and the best extension method overload 'System.Linq.Enumerable.Select<TSource,TResult>(System.Collections.Generic.IEnumerable<TSource>, System.Func<TSource,TResult>)' has some invalid arguments.

  • 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-06-16T02:37:37+00:00Added an answer on June 16, 2026 at 2:37 am

    Facepalm moment. The issue was that the DTO had a typo in a field name and wasn’t compiling, however it was lost in the error log. Fixing the typo in the DTO made the types match properly and all is now well. Thanks.

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

Sidebar

Related Questions

I have a collection of objects that each defined by a particular group. How
I'm trying to construct a linq query that pulls all nodes that have a
We have a simple LINQ-to-Entities query that should return a specific number of elements
I have the following Xelemnt that contains a linq query within it. The query
I have an XDocument object. I want to query for elements with a particular
I have an unbound Gridview that is populated by a Linq to Entities query
I have a particular scenario where I wrote my code using LINQ-SQL but I
I have a particular file in a git source code repository that contains production
I have a particular application that needs to calculate something very specific, and while
I have a particular web application that like most others, has to account for

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.