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

  • Home
  • SEARCH
  • 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 6908759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:36:12+00:00 2026-05-27T08:36:12+00:00

I have been trying to figure this out, but couldn’t. On php a multidimensional

  • 0

I have been trying to figure this out, but couldn’t.
On php a multidimensional array would looks like this:

$array = array(
  1 => array("height" => 10, "width" => 20, "length" => 30),
  2 => array("height" => 10, "width" => 20, "length" => 30),
  3 => array("height" => 10, "width" => 20, "length" => 30),
);

And them I would get the value using

echo $array[3]["height"]; // output 10
echo $array[3]["width"]; // output 20

I have tried to use Dictionary, but I have no idea on how to accomplish this.
Any help is appreciated
Thanks

EDIT:
This is the code I used that worked for me, hope this helps someone.

    Dictionary<int, Dictionary<string, int>> array = new Dictionary<int, Dictionary<string, int>>();
    Dictionary<string, int> sub = new Dictionary<string, int>();
    sub.Add("height", 10);
    sub.Add("width", 20);
    sub.Add("length", 30);
    array.Add(1, sub);

    sub = new Dictionary<string, int>();
    sub.Add("height", 10);
    sub.Add("width", 20);
    sub.Add("length", 30);
    array.Add(2, sub);

    sub = new Dictionary<string, int>();
    sub.Add("height", 10);
    sub.Add("width", 20);
    sub.Add("length", 30);
    array.Add(3, sub);

    Response.Write("height: " + array[1]["height"]);
    Response.Write("<br />width: " + array[1]["width"]);
    Response.Write("<br />length: " + array[1]["length"]);
  • 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-27T08:36:13+00:00Added an answer on May 27, 2026 at 8:36 am

    What you are doing is a single-dimensional array of dictionaries:

    Dictionary<string,Decimal>[] array =
    {
        new Dictionary<string,Decimal>(){ 
            {"height", 10},
            {"width", 20},
            {"length", 30},
        },
        new Dictionary<string,Decimal>(){ 
            {"height", 10},
            {"width", 20},
            {"length", 30},
        },
        new Dictionary<string,Decimal>(){ 
            {"height", 10},
            {"width", 20},
            {"length", 30},
        },
    };
    
    Console.WriteLine(array[0]["height"]);
    
    Output: 10
    

    In C# you can declare IEnumrables with an Add method (of which both System.Array and Dictionary are children) explicitly with curly braces, so what we are doing here is declaring an array{} and three dictionaries{} inside it, and inside each dictionary three key/value pairs{}.

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

Sidebar

Related Questions

I have been trying this for some time but could not figure out yet.
I have been trying to figure this one out but I am having a
I have been trying to figure this out for way to long tonight. I
I have been trying to figure out a solution but nothing has really presented
I've been trying to figure this out for hours. I have a DYNAMIC youtube
I have been scouring the internet trying to figure this one out. Any ideas
This seems like such a simple question, but I have been trying for an
I've been trying to figure this out but can't find any answers to my
I have been trying to figure this out for about a hour and can't
Ok I have been trying every which way to figure this out. I need

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.