Click here to Skip to main content
15,918,976 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:

I am looking to store my data that is not in a fixed format in an array or list but as array is of fixed size so cant use that, list provides flexibility but it doesnt comes with multi dimensions option like array does..

I had a data like:

"Acids", "A1", "A2", "A3" - this could grow to ph4 till ph 10 depends 

"Sulphur" "S1", "S2",      - this could grow to ph4 till ph 0 depends 

"Carbon"   "c1", C2" can grow depends 

also after storing it in the list i also need to retrieve in a way that in a loop i should get first Acids then all its sub components that is A1, A2, A3, once done then move to Sulphur and get its corresponding components. 

Please can anyone suggest anything on how to best deal with this. 

What I have tried:

i tried using the lists and arrays but not getting much help
Updated 13-Sep-18 22:00pm
MadMyche 13-Sep-18 17:13pm    
OOP 101: Objects can contain other objects as well as collections. It is just a matter of knowing how to add and access them
j snooze 13-Sep-18 17:50pm    
You could do a list object for each full comma delimited line. Then when looping through each line do a .split on the comma into a string array and loop through the length of the string array. Just one way to do it, I'm sure there are many and possibly better. I don't know if that helps because I don't really know your intentions are with the data.

1 solution

You already posted this question at Dynamic Multi dimensional list - C# Discussion Boards[^]. Please do not crosspost, it duplicates effort and wastes time.
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