I'm getting a "cannot convert from 'int' to 'TValue'" in the following code. How can I fix this? I understand why there is an issue, but I'm wonder the best way around this. Do I need to make a decision to specific type the ReturnValuesDict, and not leave it generic?
public class ReturnValuesDict<TKey, TValue> : CloneableDictionary<TKey, TValue>
{
public static ReturnValuesDict<TKey, TValue> CreateEmptyClone(ReturnValuesDict<TKey, TValue> current)
{
var newItem = new ReturnValuesDict<TKey, TValue>();
foreach (var curr in current)
{
newItem.Add(curr.Key, 0); // ERROR on the 2nd parameter here
}
return newItem;
}
}