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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:19:37+00:00 2026-06-18T16:19:37+00:00

These two rows seems to do the same thing. A plussign (+) can be

  • 0

These two rows seems to do the same thing. A plussign (+) can be used instead of an anonymous type.

var newlist1 = list.GroupBy(x => x.FIELD1 + x.FIELD2).Select(y => y.First());

var newlist2 = list.GroupBy(x => new {x.FIELD1, x.FIELD2}).Select(y => y.First());

Now my question:

Is the plussign (+) something thats documented for GroupBy?

  • 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-18T16:19:38+00:00Added an answer on June 18, 2026 at 4:19 pm

    be careful of this 🙂
    If for example x.FIELD1 and x.FIELD2 are properties of type string, you’re just grouping by the result of concatenating the two…. which is probably not what you want. Same applies for other types of course, but an example in strings still:

    Given Field1 = “ABC” and Field2 = “DEF”, your grouping will be with the key “ABCDEF”, right?

    So what if you had Field1 = “AB” and Field2 = “CDEF”? Very much different values, but your grouping would still be “ABCDEF”…

    You should stick to anonymous types for grouping (when used within a method only), or when needed externally, a new class, struct, or make use of a Tuple.

    EDIT: Another quick note: after you have executed the GroupBy (without the projection), take a look at the Key values you are getting…. it should show you an example of what I mean.

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

Sidebar

Related Questions

Do these two statements pass the same type of argument (a Hash) to the
These two methods appear to behave the same to me public IEnumerable<string> GetNothing() {
These two querys gives me the exact same result: select * from topics where
So these two methods have the same signature but different constraints public static void
i'm a little confused about these two qualifiers... With ARC instead of using weak
There are two tables: A, with rows (row_id, column1, ...) and B, with rows
the mysql table below has two columns. how do i select only those rows
These two files are mostly seen in open source projects. What are they for,
These two queries work: SELECT u.id, u.email, COUNT(*) as Current FROM users u, rounds
Given these two queries: Select t1.id, t2.companyName from table1 t1 INNER JOIN table2 t2

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.