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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:47:09+00:00 2026-06-02T22:47:09+00:00

At the moment I have some code like below which based on a NoOfRows

  • 0

At the moment I have some code like below which based on a NoOfRows properties returns whether all data has been entered into list(s):

switch (NoOfRows)
            {
                case 1:
                    return InputList1.Any();
                case 2:
                    return InputList1.Any() && InputList2.Any();
                case 3:
                    return InputList1.Any() && InputList2.Any() && InputList3.Any();
                case 4:
                    return InputList1.Any() && InputList2.Any() && InputList3.Any() && InputList4.Any();
                case 5:
                    return InputList1.Any() && InputList2.Any() && InputList3.Any() && InputList4.Any() && InputList5.Any();
                case 6:
                    return InputList1.Any() && InputList2.Any() && InputList3.Any() && InputList4.Any() && InputList5.Any() && InputList6.Any();
                case 7:
                    return InputList1.Any() && InputList2.Any() && InputList3.Any() && InputList4.Any() && InputList5.Any() && InputList6.Any() && InputList7.Any();
                case 8:
                    return InputList1.Any() && InputList2.Any() && InputList3.Any() && InputList4.Any() && InputList5.Any() && InputList6.Any() && InputList7.Any() && InputList8.Any();
                case 9:
                    return InputList1.Any() && InputList2.Any() && InputList3.Any() && InputList4.Any() && InputList5.Any() && InputList6.Any() && InputList7.Any() && InputList8.Any() && InputList9.Any();
                case 10:
                    return InputList1.Any() && InputList2.Any() && InputList3.Any() && InputList4.Any() && InputList5.Any() && InputList6.Any() && InputList7.Any() && InputList8.Any() && InputList9.Any() && InputList10.Any();
                default:
                    return false;
            }

I’m thinking it might be better to refactor this code and have an List<List<int>> or a Dictionary<int,List<int>> but how would I do the above to return whether each list in the collection has something in it?

List<List<int>> values = new List<List<int>>(){InputList1, InputList2 ... InputList10};
var lists = values.Take(NoOfRows);
lists.. //check each item and return value of Any for each one
  • 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-02T22:47:11+00:00Added an answer on June 2, 2026 at 10:47 pm

    having nested lists can work well. you might want to look into the use of selectmany

    but I think the code you want is something like:

    var nested = new List<List<int>>();
    // put data in it
    
    nested.All((inner) => inner.Any());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking at some code at the moment which has been ported and is
At the moment I have the following code which works fine. label = new
At the moment I have this code which fires a projectile: Vector3 d =
I have some iPhone SDK 4.0 code which initializes an NSOperationQueue and then adds
At the moment I have this code (and I don't like it): private RenderedImage
I'm refactoring some code at the moment and have come across a selector: jQuery(tr,#ctl00_MainContent_MyUserControl).each(function(i,row)
I came across some sample code in VB.Net which I have some experience with
I am using the below code to replace some text which is working fine.
I have some C# code that looks like this: uint a = 0x9E3779B9; a
I have written some code based on a specification from my boss. A requirement

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.