C#

Moderators: None (Apply to moderate this forum)
Number of threads: 2712
Number of posts: 5738

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Best data structure for the job... Posted by ghostfacelz on 18 Aug 2009 at 8:22 AM
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.
-G
=Ghost=>
Report
Re: Best data structure for the job... Posted by DataDink on 18 Aug 2009 at 10:54 AM
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<TestItem> TestItems { get; private set; }

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



Now you only have a list of TestCases
Report
Re: Best data structure for the job... Posted by ghostfacelz on 18 Aug 2009 at 2:43 PM
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!
=Ghost=>
Report
Re: Best data structure for the job... Posted by charles1812 on 6 May 2011 at 12:24 AM
some interesting information



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.