I have this Dictionary-
IDictionary<DateTime, int> kamptslist = new Dictionary<DateTime, int>();
List<int> listints= GetListofints(); //for values
List<int> listdates= GetListofdates();// for keys
Can I somehow assign the lists directly to the Dictionary instead of actually doing a foreach
and adding one item at a time ?
You can do this easily with .NET 4:
Without .NET 4 it's a bit harder, although you could always use a grotty hack:
EDIT: As per comment, this works fine with an explicitly typed variable to: