请考虑以下代码:
class Student
{
}
enum StudentType
{
}
static void foo(IDictionary<StudentType, IList<Student>> students)
{
}
static void Main(string[] args)
{
Dictionary<StudentType, List<Student>> studentDict =
new Dictionary<StudentType, List<Student>>();
foo(studentDict);
...
}
有错误:
错误 CS1503:参数“1”:无法从“System.Collections.Generic.Dictionary>”转换为“System.Collections.Generic.IDictionary>”
有没有办法调用 foo 函数?