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.
This commit is contained in:
committed by
James Newton-King
parent
ed99856139
commit
2061a8bb9a
@@ -871,18 +871,7 @@ namespace Newtonsoft.Json.Linq
|
||||
/// </returns>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user