Are Open and Closed only relevant values of ConnectionState enumeration?

本秂侑毒 提交于 2020-01-13 13:05:13

问题


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?

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


回答1:


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.



来源:https://stackoverflow.com/questions/246316/are-open-and-closed-only-relevant-values-of-connectionstate-enumeration

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!