-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Expand file tree
/
Copy pathHRESULT.cs
More file actions
28 lines (24 loc) · 835 Bytes
/
HRESULT.cs
File metadata and controls
28 lines (24 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright (c) Files Community
// Licensed under the MIT License.
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Windows.Win32.Foundation
{
[DebuggerDisplay("{" + nameof(Value) + ",h}")]
public readonly partial struct HRESULT
{
/// <summary>
/// Throws an exception if the <see cref="HRESULT"/> indicates a failure in debug mode. Otherwise, it returns the original <see cref="HRESULT"/>.
/// </summary>
/// <returns>Returns the original <see cref="HRESULT"/> value regardless of the operation's success.</returns>
public readonly HRESULT ThrowIfFailedOnDebug()
{
#if DEBUG
if (Failed) Marshal.ThrowExceptionForHR(Value);
#endif
return this;
}
// #define E_NOT_SET HRESULT_FROM_WIN32(ERROR_NOT_FOUND)
public static readonly HRESULT E_NOT_SET = (HRESULT)(-2147023728);
}
}