Back to list
Views:   16K
Replies:  1

DIfference between IDictionary and Dictionary.

What  is DIfference between IDictionary and Dictionary in terms of implementation.
Please let me know when to use what.

Pet Hogkin, Mar 03, 2011
Reply 1
Hello Pet,

the difference is that Dictionary is concrete implementation while IDictionary is just a contract, abstraction.

It is recommended for example to expect as argument an IDictionary rather that concrete Dictionary, or to expose property of IDictionary rather that Dictionary, because this promotes loose coupling. Than you are able to change underlying objects in the future without affecting those who use your object. 

Hope this wil help.

Best regards,
Robert Varga, Mar 03, 2011
Hi Chris Thanks for your reply. I like the idea of having a collection of broken rules. I have a lot of Forms that currently use the error provider which users are now accustomed to but this may be an option as each broken rule/error message could just be displayed as a list on screen which should hopefully still be clear enough for users. The nice thing about the error provider however is it clearly highlights the control that needs attention which on large forms would be quicker for the user to spot the issue. Thanks Matt
Oct 11, 2010
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.