在编程中往往需要获取Exception 的HResult值以得到具体的错误原因。但这个值是一个保护类型的属性,无法直接读取。可通过 System.Runtime.InteropServices.Marshal.GetHRForException 这个函数来获取。