Last active
August 29, 2015 13:57
-
-
Save danielmarbach/9787441 to your computer and use it in GitHub Desktop.
Mapping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Here | |
{ | |
public class Root | |
{ | |
public string Foo { get; set; } | |
public Child Child { get; set; } | |
} | |
public class Child | |
{ | |
public string Foo { get; set; } | |
} | |
} | |
namespace There | |
{ | |
public class Root | |
{ | |
string Foo { get; set; } | |
Child Child { get; set; } | |
} | |
public class Child | |
{ | |
string Foo { get; set; } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var value = new Here.Root() { Foo ="Foo", Child = new Child { Foo = "Foo"}}; | |
string message = JsonConvert.SerializeObject(value, Formatting.Indented); | |
Debug.WriteLine(message); | |
var r = JsonConvert.DeserializeObject(message, typeof(There.Root)); | |
var remoteRoot = new There.Root(); | |
JsonConvert.PopulateObject(message, remoteRoot); | |
var foo = Mapper.DynamicMap<There.Root>(value); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment