Merge pull request #1153 from JonHanna/shortcircuit_same_compared

Short-circuit on reference equality in ValueEquals and JValue.Compare
This commit is contained in:
James Newton-King
2017-01-09 15:17:53 +13:00
committed by GitHub
2 changed files with 11 additions and 21 deletions
@@ -39,15 +39,11 @@ namespace Newtonsoft.Json.Utilities
{
public static bool ValueEquals(object objA, object objB)
{
if (objA == null && objB == null)
if (objA == objB)
{
return true;
}
if (objA != null && objB == null)
{
return false;
}
if (objA == null && objB != null)
if (objA == null || objB == null)
{
return false;
}