From 25286eb0473c816d28ec38794bc7367afb560d98 Mon Sep 17 00:00:00 2001
From: "Joel Sallow (/u/ta11ow)" <32407840+vexx32@users.noreply.github.com>
Date: Wed, 16 Oct 2019 02:38:39 -0400
Subject: [PATCH] Use more effective evaluation order in
LanguagePrimitives.IsNullLike() (#10781)
Refactor IsNullLike() to evaluate the most commonly-expected null-like values first.
---
src/System.Management.Automation/engine/LanguagePrimitives.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/System.Management.Automation/engine/LanguagePrimitives.cs b/src/System.Management.Automation/engine/LanguagePrimitives.cs
index 618a23b9f5..42fc00684b 100644
--- a/src/System.Management.Automation/engine/LanguagePrimitives.cs
+++ b/src/System.Management.Automation/engine/LanguagePrimitives.cs
@@ -1071,7 +1071,7 @@ namespace System.Management.Automation
///
/// 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.