本文介绍了打开和关闭只有ConnectionState枚举的相关值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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?

但是从这,也会使用ConnectionState.Broken。

However from this StackOverflow answer appears that ConnectionState.Broken is also used.

推荐答案

在反射器中,它看起来像我的Broken和Fetching状态也使用在至少一个或两个地方。最好的编码实践将是假设任何值可能被使用,并且代码防御。例如,如果你需要知道连接是否打开,检查状态==打开,而不是状态!=关闭。

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枚举的相关值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 23:56