diff --git a/src/System.Management.Automation/engine/LanguagePrimitives.cs b/src/System.Management.Automation/engine/LanguagePrimitives.cs index 618a23b9f51..82a11de87dd 100644 --- a/src/System.Management.Automation/engine/LanguagePrimitives.cs +++ b/src/System.Management.Automation/engine/LanguagePrimitives.cs @@ -1063,7 +1063,7 @@ internal static bool IsTrue(IList objectArray) /// /// The object to test. /// True if the object is null. - public static bool IsNull(object obj) => obj == null || obj == AutomationNull.Value; + public static bool IsNull(object obj) => obj is null || obj == AutomationNull.Value; /// /// Internal routine that determines if an object meets any of our criteria for null. @@ -1071,7 +1071,7 @@ internal static bool IsTrue(IList objectArray) /// /// The object to test. /// True if the object is null. - public static bool IsNullLike(object obj) => obj == DBNull.Value || obj == NullString.Value || IsNull(obj); + public static bool IsNullLike(object obj) => IsNull(obj) || obj == DBNull.Value || obj == NullString.Value; /// /// Auxiliary for the cases where we want a new PSObject or null.