Skip to content

Instantly share code, notes, and snippets.

@Layoric Layoric/main.cs
Last active Sep 1, 2016

Embed
What would you like to do?
Auto mapping
using System;
using ServiceStack;
using ServiceStack.Text;
public class GetPersonResponse
{
public string FirstName { get;set; }
public string LastName { get;set; }
public int Age { get;set; }
}
public class Person
{
public string FirstName { get;set; }
public string LastName { get;set; }
public int Age { get;set; }
}
var person = new Person {
FirstName = "Bob",
LastName = "Smith",
Age = 40
};
var personResponse = person.ConvertTo<GetPersonResponse>();
Console.WriteLine(personResponse.GetType().Name);
personResponse.PrintDump();
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ServiceStack.Text" version="4.0.62" targetFramework="net45" />
<package id="ServiceStack.Client" version="4.0.62" targetFramework="net45" />
<package id="ServiceStack.Interfaces" version="4.0.62" targetFramework="net45" />
</packages>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.