From 2061a8bb9ab7d2b002f647cc8628c998e8b4b4c2 Mon Sep 17 00:00:00 2001 From: Jon Hanna Date: Sun, 8 Jan 2017 02:33:03 +0000 Subject: [PATCH] Simplify Equals override in JValue (#1148) otherValue == null, including obj == null, both result in false and will also result in false if continued into the Equals(JValue) method in the first branch, so having separate branches is just extra work. --- Src/Newtonsoft.Json/Linq/JValue.cs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/Src/Newtonsoft.Json/Linq/JValue.cs b/Src/Newtonsoft.Json/Linq/JValue.cs index 2af9d763..ca7518db 100644 --- a/Src/Newtonsoft.Json/Linq/JValue.cs +++ b/Src/Newtonsoft.Json/Linq/JValue.cs @@ -871,18 +871,7 @@ namespace Newtonsoft.Json.Linq /// public override bool Equals(object obj) { - if (obj == null) - { - return false; - } - - JValue otherValue = obj as JValue; - if (otherValue != null) - { - return Equals(otherValue); - } - - return base.Equals(obj); + return Equals(obj as JValue); } ///