Skip to content

Commit 507934a

Browse files
committed
Use ArgumentNullException
1 parent de06e8b commit 507934a

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/SharedInfrastructure/Guard.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the Six Labors Split License.
33

44
using System.Diagnostics;
5+
using System.Diagnostics.CodeAnalysis;
56
using System.Runtime.CompilerServices;
67

78
namespace SixLabors;
@@ -20,16 +21,9 @@ internal static partial class Guard
2021
/// <typeparam name="TValue">The type of the value.</typeparam>
2122
/// <exception cref="ArgumentNullException"><paramref name="value"/> is null.</exception>
2223
[MethodImpl(MethodImplOptions.AggressiveInlining)]
23-
public static void NotNull<TValue>(TValue value, string parameterName)
24-
where TValue : class
25-
{
26-
if (value is not null)
27-
{
28-
return;
29-
}
30-
31-
ThrowHelper.ThrowArgumentNullExceptionForNotNull(parameterName);
32-
}
24+
public static void NotNull<TValue>([NotNull]TValue? value, string parameterName)
25+
where TValue : class =>
26+
ArgumentNullException.ThrowIfNull(value, parameterName);
3327

3428
/// <summary>
3529
/// Ensures that the target value is not null, empty, or whitespace.

0 commit comments

Comments
 (0)