I'm struggling to define an extension method for a Dictionary that has a List in its Value.
I've done this:
public static bool MyExtensionMethod<TKey, TValue, K>(this IDictionary<TKey, TValue> first, IDictionary<TKey, TValue> second) where TValue : IList<K>
{
//My code...
}
To use it I have this class:
public class A
{
public Dictionary<int, List<B>> MyPropertyA { get; set; }
}
public class B
{
public string MyPropertyB { get; set; }
}
But when I do this:
var a1 = new A();
var a2 = new A();
var a = a1.MyPropertyA.MyExtensionMethod(a2.MyPropertyA)
I get this error 'the type arguments for method '...' cannot be inferred from the usage'
How should I define the method or call it? Thanks in advance!!