StringDictionary does not implement either ICollection or IDictionary?

S

Sanjay Vyas

Sorry, forgot to cross post this one..

This is rather unusual as we would expect any Collection class to implement
ICollection interface and furthermore a Dictionary class should implement
IDictionary interface. The StringDictionary class does implements all the
methods of ICollection and IDictionary yet it does not list these
interfaces. Am I missing something here or was it an oversight on the part
of the class developer. Maybe I have attained the .NET nirvana yet?

Sanjay Vyas
 
N

Nicholas Paldino [.NET/C# MVP]

Sanjay,

This is rather odd. It should implement IDictionary, at least (I don't
think it should implement ICollection, because nothing is really indexed by
number here, and you can't guarantee the order). I'll submit it as a bug,
but the new generic classes should rectify this (as the generic will
implement the appropriate interfaces).

Hope this helps.
 
J

Jon Skeet [C# MVP]

Nicholas Paldino said:
This is rather odd. It should implement IDictionary, at least (I don't
think it should implement ICollection, because nothing is really indexed by
number here, and you can't guarantee the order).

I think you're getting confused with IList (like I did this morning).
IDictionary itself actually implements/extends ICollection - any
IDictionary is also an ICollection.
 
S

Sanjay Vyas

It must be a bug as an article on MSDN actually
mentions"....StringDictionary (based on IDictionary)...."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top