Hi I am trying to convert this C# code to VB
class MultiValueDictionary<TKey, TValue> : Dictionary<TKey, List<TValue>>
{
public void Add(TKey key, TValue value)
{
if(!ContainsKey(key))
Add(key, new List<TValue>());
this[key].Add(value);
}
}
The result looks like this:
Class MultiValueDictionary(Of TKey, TValue)
Inherits Dictionary(Of TKey, List(Of TValue))
Public Sub Add(key As TKey, value As TValue)
If Not ContainsKey(key) Then
Add(key, New List(Of TValue)())
End If
Me(key).Add(value)
End Sub
End Class
But it gives an error on the line:
Add(key, New List(Of TValue)())
Value of type 'System.Collections.Generic.List(Of TValue)' cannot be converted to 'TValue'.
I am not really that clear about the TKey TValue notation, can somebody explain what this error is telling me? What should it read instead?
Thanks in advance