c# - Cannot implicitly convert type from non-covariant generic interface -


important edit: not use dictionary in context. uses object.gethashcode() isn't use dictionary key. still learned though.

i have following declaration

private static idictionary<idictionary<string,string>, ienumerable<fishtank>> _cache; 

and following code attempt initialize it

if (_cache == null)    _cache = new dictionary<dictionary<string,string>, linkedlist<fishtank>>();  

the problem i'm having initialization generates compile time error.

cannot implicitly convert type 'system.collections.generic.dictionary,system.collections.generic.linkedlist>' 'system.collections.generic.idictionary,system.collections.generic.ienumerable>'. explicit conversion exists (are missing cast?)

i know dictionary , linkedlist implement idictionary , ienumerable respectively, i'm @ bit of loss here.

you can below

if (_cache == null)      _cache = new dictionary<idictionary<string, string>, ienumerable<fishtank>>();