在列表和字典键和_key和值与值之间的差值 [英] Difference between Key and _key and value versus Value in List and Dictionary

查看:160
本文介绍了在列表和字典键和_key和值与值之间的差值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道在List<键和_key之间的不同;>和词典,如何接近他们,并操纵它们。

Does anybody knows the different between Key and _key in the List<> and Dictionary, how to approach them and manipulate them?

推荐答案

从你的问题和例子,我猜你是枚举的DictionaryEntry 结构的集合。如果是这样的话, _key 是一个私有成员变量和是公共财产。您可以访问从你的代码,因为它是公开的,但不是 _key ,因为它是私人的。

From your question and examples, I'm guessing you are enumerating a collection of DictionaryEntry structures. If that is the case, _key is a private member variable and Key is a public property. You can access Key from your code because it is public, but not _key because it is private.

调试器能够通过反射向您展示这两个值。您应该只使用属性代码。

The debugger is able to show you both values via reflection. You should only use the Key property in your code.

这篇关于在列表和字典键和_key和值与值之间的差值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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