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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:22:09+00:00 2026-05-31T01:22:09+00:00

well, i’m almost new to c# and i couldn’t figure out how multi-leveled-arrays work

  • 0

well, i’m almost new to c# and i couldn’t figure out how multi-leveled-arrays work in c#.

i’ve made a treeView with menus in it like:


  • menu_1
  • –child_1.1
  • –child_1.2
  • —-child_1.2.1
  • —-child_1.2.2
  • —-child_1.2.3
  • –child_1.3
  • Menu_2
  • –child_2.1
  • –child_2.2
  • —-child_2.2.1

every single MenuItem should have 6 proppertys / attributes / values like this :

Item = { ID:int , “NAME:String , POSITION:String , ACTIVE:Bool , ACTION:bool , PATH:string }

so :

Menu_1 = { 1, "File", "1", true, false, "" }
child_1.1 = { 2, "Open", "1.1", true, true, "./open.exe" }

… and so on

so far :

i’ve manually set some String-Arrays ( String[] ) for eath menuItem and filled it with the informations.

String[] Item_1 = {"1", "File", "1", "1", "0", ""};
String[] Item_2 = ...

...

now i want to put all those String-Array inside an ArrayList[] and Sort() them using the “POSITION” value of each Item ( Item_1[2] )

also i want the code to dynamicly create that Array of the Item itself, reading the values from a sql table. those arrays should NOT be just String-Arrays as i did for now, cuz i want the ID to stay a int & the ACTIVE and ACTION value to stay a bool.

the final product should look like this :

MenuItems = ArrayList(
    item_1 = Array(Int, String, String, Bool, Bool, String)  // \
    item_2 = Array(Int, String, String, Bool, Bool, String)  //  \
    item_3 = Array(Int, String, String, Bool, Bool, String)  //  / all sortet by the 3rd value, the position )
    item_4 = Array(Int, String, String, Bool, Bool, String)  // /
    ...
    )
)

thanx all of you who can help me out.

  • 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-31T01:22:10+00:00Added an answer on May 31, 2026 at 1:22 am

    Assuming you’re on C# 2.0 or later, I’d use a generic list instead of an ArrayList and a class container rather than just arrays. Assuming you’re on .NET 3.5 or later, I’d suggest using LINQ for the sorting as well.

    First, make a class container for the type of the menu items:

    public class MenuItem
    {
        public int ID {get;set;}
        public string Name {get;set;}
        public string Position {get;set;}
        public bool Active {get;set;}
        public bool Action {get;set;}
        public string Path {get;set;}
    } 
    

    Then you can store instances of this class in a generic List:

    var items = new List<MenuItem>();
    items.Add(new MenuItem{ID="1", Name="File", Position="1", Active=true, Action=false, Path=""});
    

    Then, to sort this list by position, you can use LINQ:

    var sorted = items.OrderBy(i => i.Position);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Well the problem is that I was using code like this: new Date().toJSON().slice(0, 10)
well i have a configuration like this in the components part of my config
Well my windows service has to send out automated emails when the sql database
well i have used an html file like these in iframe <iframe src=sample.html></iframe> is
Well, sorry for the question, is more like a general culture one (haven't found
Well, i'm learning to work with QML and i have one doubt. In my
Well, I have to revive a question that was answered here before. I've made
Well, can they? Like jQuery using a fadeIn function for something on a C++
Well, not sure I am going to be able to write this out to
Well the subject is the question basically. Are there any version control systems out

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.