本文整理匯總了C#中Newtonsoft.Json.Linq.JArray.DeepEquals方法的典型用法代碼示例。如果您正苦於以下問題:C# JArray.DeepEquals方法的具體用法?C# JArray.DeepEquals怎麽用?C# JArray.DeepEquals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Newtonsoft.Json.Linq.JArray
的用法示例。
在下文中一共展示了JArray.DeepEquals方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: DoubleDeepEquals
public void DoubleDeepEquals()
{
JArray a =
new JArray(
double.NaN,
double.PositiveInfinity,
double.NegativeInfinity
);
JArray a2 = (JArray)a.DeepClone();
Assert.IsTrue(a.DeepEquals(a2));
double d = 1 + 0.1 + 0.1 + 0.1;
JValue v1 = new JValue(d);
JValue v2 = new JValue(1.3);
Assert.IsTrue(v1.DeepEquals(v2));
}
示例2: DeepClone
public void DeepClone()
{
JArray a =
new JArray(
5,
new JArray(1),
new JArray(1, 2),
new JArray(1, 2, 3),
new JObject(
new JProperty("First", new JValue(Encoding.UTF8.GetBytes("Hi"))),
new JProperty("Second", 1),
new JProperty("Third", null),
new JProperty("Fourth", new JConstructor("Date", 12345)),
new JProperty("Fifth", double.PositiveInfinity),
new JProperty("Sixth", double.NaN)
)
);
JArray a2 = (JArray)a.DeepClone();
StringAssert.AreEqual(@"[
5,
[
1
],
[
1,
2
],
[
1,
2,
3
],
{
""First"": ""SGk="",
""Second"": 1,
""Third"": null,
""Fourth"": new Date(
12345
),
""Fifth"": ""Infinity"",
""Sixth"": ""NaN""
}
]", a2.ToString(Formatting.Indented));
Assert.IsTrue(a.DeepEquals(a2));
}
示例3: Clone
public void Clone()
{
JArray a =
new JArray(
5,
new JArray(1),
new JArray(1, 2),
new JArray(1, 2, 3),
new JObject(
new JProperty("First", new JValue(Encoding.UTF8.GetBytes("Hi"))),
new JProperty("Second", 1),
new JProperty("Third", null),
new JProperty("Fourth", new JConstructor("Date", 12345)),
new JProperty("Fifth", double.PositiveInfinity),
new JProperty("Sixth", double.NaN)
)
);
ICloneable c = a;
JArray a2 = (JArray)c.Clone();
Assert.IsTrue(a.DeepEquals(a2));
}
示例4: DeepClone
public void DeepClone()
{
JArray a =
new JArray(
5,
new JArray(1),
new JArray(1, 2),
new JArray(1, 2, 3),
new JObject(
new JProperty("First", new JValue(Encoding.UTF8.GetBytes("Hi"))),
new JProperty("Second", 1),
new JProperty("Third", null),
new JProperty("Fourth", new JConstructor("Date", 12345)),
new JProperty("Fifth", double.PositiveInfinity),
new JProperty("Sixth", double.NaN)
)
);
JArray a2 = (JArray)a.DeepClone();
Console.WriteLine(a2.ToString(Formatting.Indented));
Assert.IsTrue(a.DeepEquals(a2));
}