mirror of
https://github.com/AlexMacocian/SystemExtensions.git
synced 2026-07-15 14:19:29 +00:00
19 lines
433 B
C#
19 lines
433 B
C#
using System.Diagnostics.CodeAnalysis;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
namespace System.Core.Extensions;
|
|
|
|
public static class ObjectExtensions
|
|
{
|
|
public static T ThrowIfNull<T>([NotNull] this T obj, [CallerArgumentExpression("obj")] string? paramName = null)
|
|
where T : class
|
|
{
|
|
if (obj is null)
|
|
{
|
|
throw new ArgumentNullException(paramName);
|
|
}
|
|
|
|
return obj;
|
|
}
|
|
}
|