I created some methods that use nested type parameters generic types in the parameter declaration:
public void Foo(IList<Pair<double, IList<double>>> myParameter)
{ // code goes here
}
What I wanted to achieve was to force this method to accept 4 types of variables:
List<Pair<double, List<double>>> myVar
List<Pair<double, double[]>> myVar
Pair<double, List<double>>[] myVar
Pair<double, double[]>[] myVar
But it seems that second, nested interface cannot be converted on-the-fly by C#. While trying to pass some of variables listed above to my method, I get error:
Argument 1: Cannot convert from System.Collections.Generic.List<...> to Cannot convert from System.Collections.Generic.IList<...>
Do I really need to create two aliases for this method to handle this problem? Or maybe there is some kind of trick that I could use to overcome this problem?