Use more effective evaluation order in LanguagePrimitives.IsNullLike() (#10781)

Refactor IsNullLike() to evaluate the most commonly-expected null-like values first.
This commit is contained in:
Joel Sallow (/u/ta11ow) 2019-10-16 02:38:39 -04:00 committed by Ilya
parent 3bddfcb047
commit 25286eb047

View file

@ -1071,7 +1071,7 @@ namespace System.Management.Automation
/// </summary>
/// <param name="obj">The object to test.</param>
/// <returns>True if the object is null.</returns>
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;
/// <summary>
/// Auxiliary for the cases where we want a new PSObject or null.