Code style improvements

このコミットが含まれているのは:
Sergio Pedri committed 2020-11-17 12:11:35 +01:00
1 親 145fc5817e
コミット 3c050dbad4
8ファイル変更
+68 -159

検索条件に一致するファイルはありません

+30
ファイルの表示
@@ -0,0 +1,30 @@
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using HRESULT = System.Int32;
namespace ComputeSharp.Graphics.Helpers
{
/// <summary>
/// Helper methods to efficiently throw exceptions.
/// </summary>
[DebuggerStepThrough]
internal static class HResultExtensions
{
/// <summary>
/// Throws a <see cref="Win32Exception"/> if <paramref name="result"/> represents an error.
/// </summary>
/// <param name="result">The input <see cref="HRESULT"/> to check.</param>
/// <exception cref="Win32Exception">Thrown if <paramref name="result"/> represents an error.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Assert(this HRESULT result)
{
if (result < 0)
{
static void Throw(HRESULT result) => throw new Win32Exception(result);
Throw(result);
}
}
}
}