Just a heads up, this is related to an assignment, I know the forum has rules about that, but I'm hoping the fact i'm not asking anyone to do it for me, and am instead just asking a generic question, gets around that(if not, I sincerely apologize).
So, I have a complicated dictionary that is storing data. Each instance is a new module, which has its own categories, which has its own list of values, so this is the dictionary I have:
Dictionary<string, Dictionary<string, List<string>>> modules = new Dictionary<string, Dictionary<string, List<string>>>();
The dictionary inside it is compromised of:
Dictionary<string, List<string>> categories = new Dictionary<string, List<string>>();
I'm pretty certain i'm adding values to it correctly, but I'm a tiny bit confused as to how I would then access the individual variables. For example, i just want to test they are adding properly now, so this is what i want to do:
foreach(var module in modules) {
//debug module name
foreach(var category in categories) {
//debug category name
foreach(string value in values) {
//debug all values in category
}
}
}
My confusion comes into the fact that i've no idea what datatype each of those vars would be, and I've no idea how to reference the dictionary inside modules
I'm using C#.
Thanks for reading,
Danny
So, I have a complicated dictionary that is storing data. Each instance is a new module, which has its own categories, which has its own list of values, so this is the dictionary I have:
Dictionary<string, Dictionary<string, List<string>>> modules = new Dictionary<string, Dictionary<string, List<string>>>();
The dictionary inside it is compromised of:
Dictionary<string, List<string>> categories = new Dictionary<string, List<string>>();
I'm pretty certain i'm adding values to it correctly, but I'm a tiny bit confused as to how I would then access the individual variables. For example, i just want to test they are adding properly now, so this is what i want to do:
foreach(var module in modules) {
//debug module name
foreach(var category in categories) {
//debug category name
foreach(string value in values) {
//debug all values in category
}
}
}
My confusion comes into the fact that i've no idea what datatype each of those vars would be, and I've no idea how to reference the dictionary inside modules
I'm using C#.
Thanks for reading,
Danny
Last edited: