C# ToDictionary can valueSelector give null?
- by Trimack
Hi,
I want to make a dictionary out of list in a way, that the list becomes keys and values would be empty.
I have following code
Dictionary<XmlTest, int?> testBattery =
new XmlTests().GetRandomTestBattery(id).
ToDictionary(k => k, v => null);
But I am getting the error "Cannot convert lambda expression to type System.Collections.Generic.IEqualityComparer' because it is not a delegate type"
Any ideas how could I fix it?
(I know I could iterate through and fill the dict one element at a time, but I simply want to use something more elegant)