mirror of
https://github.com/AlexMacocian/SystemExtensions.git
synced 2026-07-15 14:19:29 +00:00
Fix nullability of parameter
This commit is contained in:
@@ -5,7 +5,7 @@ namespace System.Core.Extensions;
|
||||
|
||||
public static class ObjectExtensions
|
||||
{
|
||||
public static T ThrowIfNull<T>([NotNull] 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)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<RootNamespace>System</RootNamespace>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
||||
<Version>1.6.10</Version>
|
||||
<Version>1.6.11</Version>
|
||||
<Authors>Alexandru Macocian</Authors>
|
||||
<RepositoryUrl>https://github.com/AlexMacocian/SystemExtensions</RepositoryUrl>
|
||||
<Description>Extensions for the System namespace</Description>
|
||||
|
||||
@@ -41,7 +41,7 @@ public static class ObjectExtensions
|
||||
return Optional.FromValue(obj);
|
||||
}
|
||||
|
||||
public static T ThrowIfNull<T>([ValidatedNotNull] this T obj, string name) where T : class
|
||||
public static T ThrowIfNull<T>([ValidatedNotNull] this T? obj, string name) where T : class
|
||||
{
|
||||
if (obj is null)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
||||
<RootNamespace>System</RootNamespace>
|
||||
<Version>1.6.10</Version>
|
||||
<Version>1.6.11</Version>
|
||||
<Authors>Alexandru Macocian</Authors>
|
||||
<RepositoryUrl>https://github.com/AlexMacocian/SystemExtensions</RepositoryUrl>
|
||||
<Description>Extensions for the System namespace</Description>
|
||||
|
||||
@@ -9,7 +9,7 @@ public class ObjectExtensionsTests
|
||||
[TestMethod]
|
||||
public void ThrowIfNull_NetCore_ThrowsWithCorrectName()
|
||||
{
|
||||
object obj = null;
|
||||
object? obj = null;
|
||||
try
|
||||
{
|
||||
System.Core.Extensions.ObjectExtensions.ThrowIfNull(obj);
|
||||
@@ -26,7 +26,7 @@ public class ObjectExtensionsTests
|
||||
[TestMethod]
|
||||
public void ThrowIfNull_NetStandard_ThrowsWithCorrectName()
|
||||
{
|
||||
object obj = null;
|
||||
object? obj = null;
|
||||
try
|
||||
{
|
||||
ObjectExtensions.ThrowIfNull(obj, nameof(obj));
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user