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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:40:57+00:00 2026-06-14T02:40:57+00:00

please consider this code: var result = data .GroupBy(a => groupA.Contains(a.Group) ? A :

  • 0

please consider this code:

var result = data
        .GroupBy(a => groupA.Contains(a.Group) ? "A" : 
                      groupB.Contains(a.Group) ? "B" : 
                      "N/a")
        .Select(a => new
        {
            KEY = a.Key,
            VALUE = a.Count()
        });

can any one help how to convert GroupBy to LINQ version?

thanks


Edit 1)

I want this style:

from a in ....
group a by ....
select ...
  • 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-14T02:40:58+00:00Added an answer on June 14, 2026 at 2:40 am

    you can try somethink like this but I would stick to what you have if it works

     var result=   from p in data
        group p by new 
       { Criterion = p.Contains(p.Group) ? "A" : p.Contains(p.Group) ? "B" : "N/a" } 
        into g  select new {KEY = g.Key, VALUE = g.Count()};
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

please consider this code : 1-... 2-{ 3-... 4-SqlConnection cn=new SqlConnection(); 5-... 6-} if
Please consider the following code (also in this fiddle ): var viewModel = {
Please consider this code snippet: var ul = $(.list_b).find(li).remove().end(); $.each(Sites, function (index, value) {
Consider this code snippet: $('#selectone').change(function(){ var amount; $.get('search.php', {search:'units'}, function(result){ //this will return only
please consider this code : 1)public static class MyClass 2){ 3) public static DateTime
Please consider this code: template<typename T> char (&f(T[1]))[1]; template<typename T> char (&f(...))[2]; int main()
Please consider the following code and the explanation from this Mozilla tutorial Using web
Let's consider this code: (function(){ var a = {id: 1, name: mike, lastname: ross};
Consider this code: int size = 100 * 1000 * 1000; var emu =
Please consider this code: #include <iostream> template<typename T> void f(T x) { std::cout <<

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.