Dictionary > в IDictionary >?

Обратите внимание на следующий код:

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?

5
задан Kev 17 May 2011 в 10:47
поделиться