-Added IgnoreAll to DefaultValueHandling which ignores all default class/struct/privative values
-Added support for DataMemberAttribute's EmitDefaultValue -Fixed losing decimal precision when writing JValues -Fixed error when calling ToList on empty JObjects and JArrays
This commit is contained in:
@@ -1846,5 +1846,24 @@ Parameter name: arrayIndex",
|
||||
|
||||
Assert.IsFalse(o1.DeepEquals(null));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToListOnEmptyObject()
|
||||
{
|
||||
JObject o = JObject.Parse(@"{}");
|
||||
IList<JToken> l1 = o.ToList<JToken>();
|
||||
Assert.AreEqual(0, l1.Count);
|
||||
|
||||
IList<KeyValuePair<string, JToken>> l2 = o.ToList<KeyValuePair<string, JToken>>();
|
||||
Assert.AreEqual(0, l2.Count);
|
||||
|
||||
o = JObject.Parse(@"{'hi':null}");
|
||||
|
||||
l1 = o.ToList<JToken>();
|
||||
Assert.AreEqual(1, l1.Count);
|
||||
|
||||
l2 = o.ToList<KeyValuePair<string, JToken>>();
|
||||
Assert.AreEqual(1, l2.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user