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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:22:59+00:00 2026-05-21T07:22:59+00:00

I’m just starting to learn c# and I’m having trouble with arrays. The array

  • 0

I’m just starting to learn c# and I’m having trouble with arrays. The array I want will be multidimensional, but I’m not sure of the proper way to set it up. There will be a total of three dimensions in this array and if it were printed out it would look similar to this:

1, 23, 6.4
1, 29, 1.0
1,  3, 8.68
1, 12, 0.001
1, -5, 0
2, 83, -5
2,  5, 14
2, 19, -12.5
2, 62, 8
2, 81, 1
3,  0, 1.4
3, 11, 1.7848
3, 55, 64.4
3, 82, 23
3,  6, 73.4

Dimension 1 will have a variable number of sets (would be pulled from a database)
Dimension 2 will always have 5 sets
Dimension 3 will always have 1 set

Any help would be appreciated.

[UPDATE]

I was in a hurry when I originally posted this so I didn’t have time to explain fully what this will be used for. Here is some additional information…

Each day people sort through boxes of parts and take a measurement of the parts. Each box has 5 parts that need to be measured.

B1 -> P1:M, P2:M, P3:M, P4:M, P5:M
B2 -> P1:M, P2:M, P3:M, P4:M, P5:M
B3 -> P1:M, P2:M, P3:M, P4:M, P5:M
.
.
.
Bn -> P1:M, P2:M, P3:M, P4:M, P5:M

Where “B” is the information on the box (box serial_no), “P” is the information about each part (part_no), and “M” is the measurement of each part. There will always be 5 parts in a box and we will take only one measurement on each part, but there will be a variable amount of boxes.

Before I posted I had already done research on arrays ( [] ), multidimensional arrays ( [,] ), jagged arrays ( [][] ), lists and a combination of all of them. I know with arrays you have to specify the size of each dimension whereas with lists you can add more to them.

Is there a way I could combine a 2D (which would hold the measurement information for each part) and a list (which would hold the list of boxes)?

The box information will be int, the part information will be int, but the measurement will be double.

  • 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-21T07:23:00+00:00Added an answer on May 21, 2026 at 7:23 am

    This is what I ended up doing:

    List<PartMeasurements> N = new List<PartMeasurements>();
    
    N.Add(new PartMeasurements(24, new double[,] { {54, -0.146}, {9, 1.2}, {16, 0.097}, {15, 1}, {64, -0.9774} }));
    N.Add(new PartMeasurements(4, new double[,] { {32, 0.76}, {45, 1.472}, {18, 0.005}, {52, 1.1}, {31, -0.1} }));
    N.Add(new PartMeasurements(73, new double[,] { {81, 1.56}, {24, 1.34}, {9, 0.2}, {2, 0.6}, {55, -0.5} }));
    
    public class PartMeasurements
    {
        public int BoxSerial_No;
        public double[,] partNumber_and_Measurement = new double[5, 1];
    
        public Numbers(int BoxSerial_No, double[,] partNumber_and_Measurement)
        {
            this.BoxSerial_No = BoxSerial_No;
            this.partNumber_and_Measurement = partNumber_and_Measurement;
        }
    }
    

    If I want to see what is in “N” I can do this:

    foreach(var x in N)
    {
         Console.Write("{0}\t", x.BoxSerial_No);
         for (int y = 0; y < x.partNumber_and_Measurement.GetLength(0); y++)
         {
            Console.Write("{0} ", x.partNumber_and_Measurement[y, 0]);
            Console.Write("{0} ", x.partNumber_and_Measurement[y, 1]);
         }
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.