Dictionary<List<string>, string> myDictionary = new Dictionary<List<string>, string>
{
{ new List<string> { "blackberries", "orange", "watermelon", "apple" }, "fruits" },
{ new List<string> { "spinach", "kale", "celery", "tomato", "red onion" }, "veggies" },
{ new List<string> { "almonds", "walnuts", "fish oil", "nut butter" }, "fats" },
{ new List<string> { "oatmeal", "brown rice", "beans", "lentils" }, "carbs" },
{ new List<string> { "beef", "chicken", "eggs", "salmon", "mackerel" }, "proteins" },
};
Use case is punching in a string and seeing which key it exists in and spitting out its correct value. Ex:
var temp = myDictionary[new List<string> { "beans" }];
temp returns carbs.
Though the way this is currently structured, this does not work as "beans" does not exist as a key
it exists as part of a key
.
What structure is best for this type of data usage?