-Added support for enum values to LINQ to JSON

-Added TypeNameAssemblyFormat property to JsonSerializer. Property controls whether .NET type names are written with a full or partial assembly name
-Added TypeNameHandling to JsonProperty attribute. Allows a type names to be included on an individual property basis
-Fixed serializing HashSet<T>
-Additional permission demands added to DynamicCodeGeneration flag
This commit is contained in:
JamesNK
2010-04-02 09:56:43 +00:00
parent 0f148a9788
commit f7cc6abfd9
28 changed files with 355 additions and 79 deletions
@@ -3372,5 +3372,31 @@ keyword such as type of business.""
Assert.AreEqual(4.3, d[1]);
Assert.AreEqual(null, d[2]);
}
#if !SILVERLIGHT && !NET20 && !PocketPC
[Test]
public void SerializeHashSet()
{
string jsonText = JsonConvert.SerializeObject(new HashSet<string>()
{
"One",
"2",
"III"
}, Formatting.Indented);
Assert.AreEqual(@"[
""One"",
""2"",
""III""
]", jsonText);
HashSet<string> d = JsonConvert.DeserializeObject<HashSet<string>>(jsonText);
Assert.AreEqual(3, d.Count);
Assert.IsTrue(d.Contains("One"));
Assert.IsTrue(d.Contains("2"));
Assert.IsTrue(d.Contains("III"));
}
#endif
}
}