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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:03:12+00:00 2026-06-07T20:03:12+00:00

[0,0,0] [1,1,1] [2,2,2] I have the above 2 dimensional array. I need to check

  • 0
[0,0,0]
[1,1,1]
[2,2,2]

I have the above 2 dimensional array.

I need to check for 3 things, first is to check if all the cells are filled just like above.

Second:

[0,0,0]
[1]
[]

For the above array, I need to check if all the cells are populated per row.

Third:

[0,]
[1,1]
[2,2,2]

I want to find if the first elements of first column are populated.

I can do it with foreach loops, or for loop. but i want to use All(predicate) with linq.

            foreach (var ticketValue in ticketValues)
            {
                firstRow = ticketValue.All(x => x == i);

                foreach (var value in ticketValue)
                {

                }
            } 

What would be the best way to do this?

  • 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-07T20:03:13+00:00Added an answer on June 7, 2026 at 8:03 pm

    I’m assuming you’re setting up that 2D like this:

    int?[][] myArrayA = new int?[][] { new int?[] {0,0,0}, new int?[] {1,1,1}, new int?[] {2,2,2} };
    int?[][] myArrayB = new int?[][] { new int?[] {0,0,0}, new int?[] {1}, new int?[] {null} };
    int?[][] myArrayC = new int?[][] { new int?[] {0,null}, new int?[] {1,1,1}, new int?[] {2,2,2} };
    

    So, using Linq we do this:

    bool FirstCheck(int?[][] theArray)
    {
        int size = (from arrays in theArray select arrays.GetUpperBound(0)).Max();
    
        var check = from arrays in theArray
                    where theArray.All(sub => sub.GetUpperBound(0) == size)
                    select arrays;
    
        return size + 1 == check.Count<int?[]>();
    }
    
    bool SecondCheck(int?[][] theArray)
    {
        int size = (from arrays in theArray select arrays.GetUpperBound(0)).Max();
    
        var check = from arrays in
                        (from subs in theArray
                         where theArray.All(sub => sub.All(value => value != null))
                         select subs)
                    where arrays.GetUpperBound(0) == size
                    select arrays;
    
        return size + 1 == check.Count<int?[]>();
    }
    
    bool ThirdCheck(int?[][] theArray)
    {
       int size = (from arrays in theArray select arrays.GetUpperBound(0)).Max();
    
       var check = from arrays in theArray
                   where theArray.All(array => array[0].HasValue)
                   select arrays;
    
       return size + 1 == check.Count<int?[]>();
    }
    

    Hope that’s what you were wanting…

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

Sidebar

Related Questions

I have a two-dimensional numpy array(uint16), how can I truncate all values above a
I have a multi-dimensional array right now that looks like this: function art_appreciation_feeds() {
As above, say I have a 3 dimensional array, a[][][], and I want to
I have a multi-dimensional array and what i want is in each second degree
I have an array of two dimensional Arrays. I want to create a new
Hi I have the array below, I need to copy the contents into another
I have an single-dimensional array of PHP objects. Each object has two attributes, one
I need to read a bi-dimensional array and convert the values into an HTML
I have a output file which is a two dimensional array (this file was
I have a 2D-array that I want to sort based on the second column.

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.