C#C
C#3y ago
Chris TCC

❔ store data like a filesystem

I'm working on an app, where the data structure is as follows:
Group -> subgroup -> values
The user can create groups, name them, and add subgroups inside them. The subgroups can have names too, and contain a list of int values. The app will then do some comparisons and list the smallest int value given some conditions etc. (That part isn't too important)
How I currently do this is by using a triple layered list, but it is quite messy and is difficult for me to trace myself relative to the hierarchy, such as knowing when a subgroup is added etc. I use events and subscriptions to broadcast adding and removing groups/subgroups/values to the parents and grandparents, and when processing the data I use a for loop to loop through each branch of this hierarchy, comparing them with an if statement to get the value needed. Is there any more efficient way to do this?

Sorry if the explanation is bad, I'm not good at doing this.
I'm also fully self taught so pls be gentle with me 😅
Was this page helpful?