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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:15:57+00:00 2026-06-11T10:15:57+00:00

I am doing some shipping calculations. I need some help trying to figure this

  • 0

I am doing some shipping calculations. I need some help trying to figure this out.
Basically, I have a generic list of products with Length, Width, and Height properties.

I would like to EASILY look at the products and find the largest values of all three properties.
From here, I can do some math and figure out the box size based on the # of products.

My initial thought would be to make 3 arrays and find the max of each. Just wanted to see if there was a simpler or cooler way I didnt’ know.

  • 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-11T10:15:58+00:00Added an answer on June 11, 2026 at 10:15 am

    Sounds like an array of arrays. As you read each element (box) from your data source (SQL Server, XML, etc), create an 3-member array and insert the attributes in order of size. Then, add the three-member array to an array of arrays. You can then sort the array of arrays by the first, second or third member using LINQ or some other function.

    Box1,2,2,3
    Box2,5,10,1
    Box3,8,4,7
    

    Becomes:

    {  {10,5,1},  {8,7,4},  {3,2,2}  } // First
    

    or

    {  {8,7,4},  {10,5,1},  {3,2,2}  } // Second
    

    or

    {  {8,7,4},  {3,2,2},  {10,5,1}  } // Third
    

    Then, you can sort the array by the first element, second element, etc.

    You could easily build an array of arrays in a single statement using LINQ, but exactly how you would do so depends on the data source. Assuming you have an class named Box with three parameters, Length, Width and Height, and that you have created a strongly-typed collection containing instances of this class:

    class BoxSorter {
    
        public IEnumerable<Box> Boxes {
            get;
            private set;
        }
    
        class Box {
            public double Height {
                get;
                set;
            }
    
            public double Width {
                get;
                set;
            }
    
            public double Length {
                get;
                set;
            }
        }
    
        public void Initialize() {
    
            this.Boxes = new List<Box>( new Box[] { 
                new Box() { Height = 2, Length = 2, Width = 3 },
                new Box() { Height = 5, Length = 10, Width = 1 },
                new Box() { Height = 8, Length = 4, Width = 7 }
            } );
    
        }
    
        public void Sort() {
    
            var l_arrayOfArrays =
                this.Boxes.Select(
                // Create an array of the Height, Length and Width, then sort the array elements (largest to smallest)
                    b => new double[] { b.Height, b.Length, b.Width }.OrderByDescending( v => v ).ToArray()
                );
    
            var l_dimension1 =
                l_arrayOfArrays.OrderByDescending(
                // Sort the array of arrays by the first (and largest) dimension
                    a => a[0]
                );
    
            var l_dimension2 =
                l_arrayOfArrays.OrderByDescending(
                // Sort the array of arrays by the second (and middle) dimension
                    a => a[1]
                );
    
            var l_dimension3 =
                l_arrayOfArrays.OrderByDescending(
                // Sort the array of arrays by the third (and smallest) dimension
                    a => a[2]
                );
    
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating this online store with a javascript shopping cart. Some products have options,
I know that UPS has some APIs they make available for doing shipping calculations.
im doing some practice sql problems one of the questions is: Prepare a shipping
Doing some jquery animation. I have certain divs set up with an attribute of
I'm doing some research for my project where I'm gone have a shopping cart.
I have this quite long query that should give me some information about shipments,
I'm trying to use SSLSniff's tool, and I have some technical issues... I've been
I'm trying to write a shipping calculator, doing pretty good so far. The input
I have this basic shopping list app where in the first view there are
I was doing some debugging, trying to see how a condition for a promotion

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.