This question already has an answer here:
- HRESULT Enumeration C# 3 answers
I'm creating a COM class in C#, which will be called from unmanaged C++. I want to use ThrowExceptionForHR but I'd rather not have to hard-code HRESULT numeric values.
I was expecting there would be some enum of common HRESULT values in .Net somewhere?
Put another way, where can I find named symbols which map to HRESULT values to pass into ThrowExceptionForHR
?
Update:
MS talk about it in this page: HRESULT Information in Managed Code. They reference VSConstants class Microsoft.VisualStudio.VSConstants but when I try to use this, it claims that namespace doesn't exist.