gpt4 book ai didi

c# - 为什么 Exception.HResult 的 getter 不再 protected ?

转载 作者:太空宇宙 更新时间:2023-11-03 23:42:44 27 4
gpt4 key购买 nike

自 .NET 4.5 起,Exception.HResult 的 setter/getter 现在是 public,但它曾经是 protected

来自 MSDN:

Starting with the .NET Framework 4.5, the HResult property's setter is protected, whereas its getter is public. In previous versions of the .NET Framework, both getter and setter are protected.

我们知道为什么要进行此更改吗?

最佳答案

In .NET 4.5, the HResult property getter is now Public, so you do not have to use Marshal.GetHRForException (along with its side affects) anymore.

来源:How to check if IOException is Not-Enough-Disk-Space-Exception type?

关于c# - 为什么 Exception.HResult 的 getter 不再 protected ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28504709/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com