I'm trying to add multiple generic list objects to the same key in my dictionary. How do I add multiple generic list objects without getting an error that says my list cannot be converted to an object. Also, I'm not trying to add items to one list. I'm trying to have multiple separate lists that are assigned to a key so I can access it when creating separate tables in my web application.
I am a newbie to c# so please help in terms of understanding what I should be doing. I've tried to say myDict[id].Add(List<object>)
but still get an error that the list cannot be added.
Dictionary<int, `List<Roll>> myDict = new Dictionary<int, List<Roll>>();
if (myDict.ContainsKey(ID))
{
myDict[ID].Add(_WorkRolls);
myDict[ID].Add(_UsedRolls);
}
else
{
myDict.Add(ID, _OldRolls);
}
My error keeps giving back that "CS1503 Argument 1: cannot convert from 'System.Collections.Generic.List' to 'Roll'
UPDATE: I decided to just use 2-D Lists. Thanks!