E
Ethan Strauss
Guest
Hi,
I work a lot with fairly complex generic collections (for example Dictionary<string, List<string[]>>) and encounter the issue that the complier won't accept them as valid instances where the contained classes are interfaces. For example, when I try to pass a Dictionary<string, List<string[]>>to a method which takes a Dictionary<string, IEnumerable<string[]>>, I get conversion errors. Obviously I can get around this, but it's a pain and I don't understand why it doesn't work. Anyone know?
I know I could encapsulate these collections into classes, and I do when it seems appropriate, but does not always seem worth the work.
Thanks,Ethan
Ethan Strauss
Continue reading...
I work a lot with fairly complex generic collections (for example Dictionary<string, List<string[]>>) and encounter the issue that the complier won't accept them as valid instances where the contained classes are interfaces. For example, when I try to pass a Dictionary<string, List<string[]>>to a method which takes a Dictionary<string, IEnumerable<string[]>>, I get conversion errors. Obviously I can get around this, but it's a pain and I don't understand why it doesn't work. Anyone know?
I know I could encapsulate these collections into classes, and I do when it seems appropriate, but does not always seem worth the work.
Thanks,Ethan
Ethan Strauss
Continue reading...