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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:50:45+00:00 2026-05-29T22:50:45+00:00

Is there anyway to combine the 2 linq expressions into one? I.e. so one

  • 0

Is there anyway to combine the 2 linq expressions into one? I.e. so one LINQ expression will return both the DistCount and the NormCount into the 2 separate int variables.

DistCount = (from string row in myList[i]
                where row.Length > 0
                select row).Distinct().Count();

NormCount = (from string row in myList[i]
                where row.Length > 0
                select row).Count();
  • 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-29T22:50:47+00:00Added an answer on May 29, 2026 at 10:50 pm

    do a group by row. You’ll then have the distinct count (# of groups) and the total (sum of Counts)

    var q = (from string row in myList[i]
        where row.Length > 0
        group row by row into rowCount
        select new {rowCount.Key, rowCount.Count})
    
    int distinct = q.Count();
    int total = q.Sum(r=>r.Count);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way I can combine list of expressions into one? I have
Is there anyway to combine all resources into a single exe file such as
Is there anyway to combine rows inside of two separate Matrix fields? I have
i was wondering if there was anyway of combining two characters to form one
Is there anyway to bind the values from separate dojo date picker and dojo
HI there I was wondering if there is anyway to combine all Contract.Requiere in
Is there any way to combine groups and the * features of regular expressions
Is there any way to combine the following and set @FH_RecordKey and @VF_dept_seq in
Is there any way to combine all of this to reduce the amount of
Is there anyway or any addin for VS2010 that can remove all the comments

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.