Consider evaluation of following C# code under .net project with latest Json.NET nugget.
...
object x = Get();
var shouldEqual = x == "a"; //false
string x2 = Get();
var shouldEqual2 = x2 == "a"; //true
object x3 = Get();
var shouldEqual3 = x3.Equals("a"); //true
object x4 = "a";
var shouldEqual4 = x4 == "a"; //true
...
private class A
{
public string X { get; set; }
}
private string Get()
{
var des = JsonConvert.DeserializeObject<A>("{\"x\": \"a\"}");
return des.X;
}
Could somebody clarify why would first condition produce negative comparison result.
Basically ran into problem under Xamarin's Android platform. After culpirit was extracted, retesting it in Console App produced same results.
Thanks in advance.