Skip to content

Instantly share code, notes, and snippets.

@danielmarbach
Last active August 29, 2015 13:57
Show Gist options
  • Save danielmarbach/9787441 to your computer and use it in GitHub Desktop.
Save danielmarbach/9787441 to your computer and use it in GitHub Desktop.
Mapping
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; }
}
}
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