I am trying to create a nested Dictionary and get an error that seems odd to
me. Here is my declaration:
private IDictionary<Guid, IDictionary<Guid, string>>
myNestedDictionary
= new Dictionary<Guid, Dictionary<Guid, string>>();
I get an error unless I nest a Dictionary and not an IDictionary:
Error 3 Cannot implicitly convert type
'System.Collections.Generic.Dictionary<System.Guid ,System.Collections.Generic.Dictionary<System.Guid ,string>>'
to
'System.Collections.Generic.IDictionary<System.Gui d,System.Collections.Generic.IDictionary<System.Gu id,string>>'.
An explicit conversion exists (are you missing a
cast?) C:\Projects\DemoProject\Presenter\View\IncidentVie wState.cs 29 15 Presenter
So this works:
private IDictionary<Guid, Dictionary<Guid, string>>
myNestedDictionary
= new Dictionary<Guid, Dictionary<Guid, string>>();
I would rather deal with the interface but I am forced to the implentation.
Thanks,
David Morris