Best data structure for the job...

I have been thinking about this issue for a couple of days and doing a lot of research on it. I have a few good ideas on implementation, but I dont feel its too elegant. I would like to ask you on your thoughts.
Here is the situation.

I have an unknown number of test cases.
Ok, a list.

But, within this list, is another list. A list of items that fall under this test case.
Ok, a list of lists. Not too bad.

But within this inner list, each item on the list is an array that will hold [name][id][etc.]

This is the area that trips me up.
I just cant visualize a list of lists of arrays.

Any suggestions on what too look at or how to implement such a structure?
I would appreciate any help or advice.

Thanks in advance.


  • That's what classes are for

    public class TestItem
    public string Name { get; set; }
    public int Id { get; set; }
    public string Etc { get; set; }

    public TestItem(string name, int id, string etc)
    Name = name;
    Id = id;
    Etc = etc;

    public class TestCase
    public string CaseName { get; set; }
    public string CaseDescription { get; set; }
    public List TestItems { get; private set; }

    public TestCase(string name, string desc, params TestItem[] items)
    CaseName = name;
    CaseDescription = desc;
    TestItems = new List(items);

    Now you only have a list of TestCases
  • Ha. Beautiful.
    Dont know why I didnt think of that.
    This is much more readable than what I came up with.

    Thanks a lot for the help!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!