问题描述
借助 MSDN页面上ConnectionState列举说此值保留供产品的未来版本中,对于除开和关的所有值。这意味着什么?是否有其他值甚至用?
The MSDN page on ConnectionState enumeration says "This value is reserved for future versions of the product", for all values except Open and Closed. What does that mean? Are other values even used?
不过从这个StackOverflow回答的似乎ConnectionState.Broken也用于
However from this StackOverflow answer appears that ConnectionState.Broken is also used.
推荐答案
花一些时间在反射器后,它看起来对我来说,中碎和抓取状态也用在至少有一个或两个地方。最佳的编码做法是假设任何值的可能被使用,code防守。举例来说,如果你需要知道,如果连接是打开的,检查状态==开放,而不是国家!=封闭。
After spending some time in Reflector, it looks to me like the Broken and Fetching states are also used in at least one or two places. The best coding practice would be to assume that any of the values might be used, and code defensively. For instance, if you need to know if the connection is open, check for state == Open, rather than state != Closed.
这篇关于是ConnectionState枚举的打开和关闭的唯一相关的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!