Skip to content

Commit a6892d0

Browse files
committed
Add implicit converter or HResult -> bool
1 parent dc1c576 commit a6892d0

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Utility/HResult.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public readonly struct HResult
1313
internal HResult(int value) => Value = value;
1414
public static implicit operator int(HResult value) => value.Value;
1515
public static implicit operator uint(HResult value) => (uint)value.Value;
16+
public static implicit operator bool(HResult value) => value.Value == 0;
1617
public static implicit operator HResult(int value) => new(value);
1718
public static implicit operator HResult(uint value) => new((int)value);
1819
public static implicit operator HResult(bool value) => new(value ? 0 : 1);

0 commit comments

Comments
 (0)