Instead, I would use the Dictionary compilation:
var firstList = new List<ofsometype>();
var secondList = new List<ofsomeanothertype>();
var thirdlist = new List<anothertype>();
var listsDict = new Dictionary<Type, object>();
listsDict.Add(typeof(ofsometype), firstlist);
listsDict.Add(typeof(ofsomeanothertype), secondlist);
listsDict.Add(typeof(anothertype), thirdlist);
The advantage here is that it gives you information about the type of list. This can be used for two things:
- Filter list for a specific type only
- Know the type
List<object>later, just using the key
PS
Depending on what the solution is and what you need to achieve, you can use generics (if the type is known) or dynamic- if the type is unknown, but a dynamic operation at runtime is required if the compiler does not know the type.