none
How to create a Linked List of Lists RRS feed

  • Question

  • Hi,

    I am trying to create a linked list where each element is a list. I am having difficulty doing this.

    - LinkedList<T0> where
    - T0 is a List<T1> where
    - T1 is an enum type that I defined in the namespace section of the program

    There are three areas in the program:
    - namespace where I can create types such as the T1 enum type
    - public class MyProgram
    - protected override void Execute() where I can define the LinkedList instance

    I am having difficulty creating a type out of List<T1> I think. If I can do this then in the Execute() section:
    - LinkedList<ListType> MyLinkedList = new LinkedList<ListType>();

    Your suggestions are appreciated.

    Regards,
    Hal

    Thursday, May 17, 2012 9:58 PM

Answers

  • Hi,

    The following worked:

    in the namespace section:

     public class MyList
      {
      public List<MyEnumType> MyList0  = new List<MyEnumType>();
      }

    This made a type out of the list which then I could use as type in the LinkedList definition.

    Thanks!

    • Marked as answer by Hal Murty Thursday, May 17, 2012 10:22 PM
    Thursday, May 17, 2012 10:22 PM

All replies

  • Create a structure wiht one member being a a List and another member being a pointer the the next list.  Yo can also have additionals pointer in teh structure to the prevous list, the first entry, and the last entry.

    jdweng

    Thursday, May 17, 2012 10:03 PM
  • Hi,

    The following worked:

    in the namespace section:

     public class MyList
      {
      public List<MyEnumType> MyList0  = new List<MyEnumType>();
      }

    This made a type out of the list which then I could use as type in the LinkedList definition.

    Thanks!

    • Marked as answer by Hal Murty Thursday, May 17, 2012 10:22 PM
    Thursday, May 17, 2012 10:22 PM