Last active
August 10, 2016 02:34
-
-
Save joehanna/730cc57a4e87cb1f692b34237824379c to your computer and use it in GitHub Desktop.
HelloEmployeeTest
This file contains hidden or 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
| using System; | |
| using Newtonsoft.Json; | |
| using System.Collections.Generic; | |
| public class Employee | |
| { | |
| public Employee(string lastName, string firstName) { | |
| FirstName = firstName; | |
| LastName = lastName; | |
| } | |
| public string FirstName { get; set; } | |
| public string LastName { get; set; } | |
| } | |
| var employees = new List<Employee>(); | |
| employees.Add(new Employee("John", "Doe")); | |
| employees.Add(new Employee("Anna", "Smith")); | |
| employees.Add(new Employee("Peter", "Jones")); | |
| var json = JsonConvert.SerializeObject(employees); | |
| Console.WriteLine($"json: {json}"); | |
| employees = JsonConvert.DeserializeObject<List<Employee>>(json); | |
| employees.ForEach(x => Console.WriteLine($"First: {x.FirstName} Last: {x.LastName}")); |
This file contains hidden or 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
| <?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" /> | |
| <package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" /> | |
| </packages> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment