Let's say I've the following drawing:

Is it more likely to use an Array or a List?
(The max of Px (p1,p2...) is 10)

If it's possible to do in an Array can you please give me a quick explanation how?

Edited 4 Years Ago by iPanda: n/a

Attachments Untitled.jpg 46.64 KB

Can you re-post the picture?
I'm afraid to click that link.
Can you attach it to the message instead of posting a link?

That would (most likely) be a linked list with some of the elements terminating to null.
...or even a dictionary with Lists as members -- one of which is a linked-list.

Edited 4 Years Ago by thines01: clarity

I've one more question, is this code able to do the orientation that I've been asked to do?
(I know that this is not the full syntax but lets say that from line 39 forward its in the Main)

using System;
namespace ConsoleApplication1
    public class Page
        private string name;
        private Page[] links = new Page[0];
        public Page(string name)
            this.name = name;
        public string GetName()
            return this.name;
        public void AddLink(Page link)
            if (this.links.Length < 10)
                Page[] a = new Page[this.links.Length + 1];
                for (int i = 0; i < this.links.Length; i++)
                    a[i] = this.links[i];
                a[a.Length - 1] = link;
                this.links = a;

        public Page[] GetAllLinks()
            return this.links;



page index = new page("Index");
page p1 = new page("p1");
page p2 = new page("p2");
page p3 = new page("p3");
page p4 = new page("p4");
page p5 = new page("p5");
page p6 = new page("p6");

It might work, but there's a better way to do that?

Edited 4 Years Ago by iPanda: n/a

...maybe shortening the code with something like

index.AddLink(new page("p1"));

...would be cleaner if you never have to directly access p1 outside of the master page

This article has been dead for over six months. Start a new discussion instead.