Fix ThrowIfNull

This commit is contained in:
2024-10-16 14:09:13 +02:00
parent 33584e8a14
commit 25eae4061b
3 changed files with 5 additions and 9 deletions
@@ -1,10 +1,11 @@
using System.Runtime.CompilerServices;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
namespace System.Core.Extensions;
public static class ObjectExtensions
{
public static T ThrowIfNull<T>([ValidatedNotNull] this T obj, [CallerArgumentExpression("obj")] string? paramName = null)
public static T ThrowIfNull<T>([NotNull] this T obj, [CallerArgumentExpression("obj")] string? paramName = null)
where T : class
{
if (obj is null)
@@ -14,9 +15,4 @@ public static class ObjectExtensions
return obj;
}
[AttributeUsage(AttributeTargets.Parameter)]
sealed class ValidatedNotNullAttribute : Attribute
{
}
}