是什么字典之间的差异(字符串,字符串)和IDictionary的(字符串,字符串) [英] What is the difference between dictionary(Of String, String) and IDictionary(Of String, String)

查看:83
本文介绍了是什么字典之间的差异(字符串,字符串)和IDictionary的(字符串,字符串)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以做任何事情,或多或少与IDictionary的?如何将这些两个集合有什么不同?

Can I do anything more or less with IDictionary? How do these two collections differ?

推荐答案

IDictionary的只是一个接口 - 它描述了实现类必须做什么合同。字典是实现该接口,因此必须提供IDictionary接口描述的方法的具体类。

IDictionary is only an interface - a contract which describes what an implementing class must do. Dictionary is a concrete class that implements that interface and hence must provide the methods described in the IDictionary interface.

如果你想创建你必须创建一个具体的类(即词典)一本字典,但如果你想与字典做的是IDictionary接口暴露的方法,你可以通过concreate类圆形作为一个接口 - 这减少的方法之间的耦合。

If you want to create a dictionary you must create a concrete class (i.e. Dictionary), but if all you want to do with that dictionary is methods exposed by the IDictionary interface you can pass the concreate class round as an interface - which reduces the coupling between methods.

这篇关于是什么字典之间的差异(字符串,字符串)和IDictionary的(字符串,字符串)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆