Skip to content

Commit de06e8b

Browse files
committed
Add notnull to guard
1 parent bf398a9 commit de06e8b

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/SharedInfrastructure/DebugGuard.cs

Lines changed: 4 additions & 8 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;
@@ -22,14 +23,9 @@ internal static partial class DebugGuard
2223
/// <typeparam name="TValue">The type of the value.</typeparam>
2324
/// <exception cref="ArgumentNullException"><paramref name="value"/> is null.</exception>
2425
[Conditional("DEBUG")]
25-
public static void NotNull<TValue>(TValue value, string parameterName)
26-
where TValue : class
27-
{
28-
if (value is null)
29-
{
30-
ThrowArgumentNullException(parameterName);
31-
}
32-
}
26+
public static void NotNull<TValue>([NotNull] TValue? value, string parameterName)
27+
where TValue : class =>
28+
ArgumentNullException.ThrowIfNull(value,parameterName);
3329

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

0 commit comments

Comments
 (0)