Simple Mapper in C#
During application development you may need to convert your Domain-Models/Business-Objects to DTO or vice-versa. The famous library for solving this issue is AutoMapper but some times you can use this simple class with this implementation :) https://gist.github.com/imranbaloch/19ef360b5e45603860ba
public static class Mapper { public static T2 Map<T1, T2>(T1 t1) { var json = JsonConvert.SerializeObject(t1); return JsonConvert.DeserializeObject<T2>(json); } }