-Refactor parameterized collection creation to use delegates

This commit is contained in:
James Newton-King
2014-05-02 17:49:13 +12:00
parent bbcc7e4d54
commit c299fee560
10 changed files with 71 additions and 65 deletions
@@ -43,6 +43,33 @@ namespace Newtonsoft.Json.Tests.Serialization
[TestFixture]
public class MetadataPropertyHandlingTests : TestFixtureBase
{
public class User
{
public string Name { get; set; }
}
[Test]
public void Demo()
{
string json = @"{
'Name': 'James',
'Password': 'Password1',
'$type': 'Newtonsoft.Json.Tests.Serialization.MetadataPropertyHandlingTests+User, Newtonsoft.Json.Tests'
}";
object o = JsonConvert.DeserializeObject(json, new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.All,
// no longer needs to be first
MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead
});
User u = (User)o;
Console.WriteLine(u.Name);
// James
}
[Test]
public void DeserializeArraysWithPreserveObjectReferences()
{