Click here to Skip to main content
15,870,297 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I need to maintain the hierarchy of requirement internally and store names in array list and do some operations on it, so I’m using Composite design pattern of .Net, but still I am facing some problem on it.
So could you please suggest me how to resolve this problem?

Hierarchy should look like this..

SQL
1.  Requirement1
1.1.    Table1
1.1.1.  Column1
1.1.2.  Column2
1.1.3.  Column3
1.2.    Table2
1.2.1.  Column1
1.2.2.  Column2
1.2.3.  Column3
And so on…
2.  Reuirement2
2.1.    Table1
2.1.1.  Column1
2.1.2.  Column2
2.1.3.  Column3
2.2.    Table2
2.2.1.  Column1
2.2.2.  Column2
2.2.3.  Column3
And so on
Posted

1 solution

You need to store the data in hierarchical fashion so you don't need a design pattern you need a heirarichal data structure. I suggest to create and mimic a tree data structure for this job. You will find some help on how to do this here:

http://stackoverflow.com/questions/1913655/c-sharp-hierarchical-categories-structure[^]
http://stackoverflow.com/questions/66893/tree-data-structure-in-c-sharp[^]

Also, you can find a lot of good article on how to create a tree structure using C# on the web.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900