Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Student {
- public string Name {get;set;}
- public string LastName {get;set;}
- public Address Address {get;set;}
- }
- public class Address {
- public string Street {get;set;}
- }
- public class StudentResult
- {
- public string Name { get; set; }
- public Address Address {get;set;}
- }
- public class CloneHelper {
- public static T Execute<T>(object input) {
- var t = JsonConvert.SerializeObject (input);
- var t2 = JsonConvert.DeserializeObject<T> (t);
- return (T)t2 ;
- }
- public static void UnitTest() {
- var student = new Student () {
- Name = "first",
- LastName = "last",
- Address = new Address () {
- Street = "street"
- }
- };
- var studentResult = CloneHelper.Execute<StudentResult> (student);
- throw new ArgumentException ("insert breakpoint debug here");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement