-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
51 lines (44 loc) · 1.29 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
namespace Scenario2
{
class Program
{
static void Main(string[] args)
{
string jsonString = GetJsonString();
Account account = Deserialize(jsonString);
Console.WriteLine(account?.Email);
Console.WriteLine("Press any key to continue ...");
Console.ReadLine();
}
// TODO:
// 1) Deserialize the json string into an "account" object and return it.
private static Account Deserialize(string jsonString)
{
// <Add/modify code here>
return null;
}
private static string GetJsonString()
{
// Note: Do NOT modify the JSON string.
string json = @"{
""Email"": ""james@example.com"",
""Active"": true,
""CreatedDate"": ""2013-01-20T00:00:00Z"",
""Roles"": [
""User"",
""Admin"",
]
}";
return json;
}
}
public class Account
{
public string Email { get; set; }
public bool Active { get; set; }
public DateTime CreatedDate { get; set; }
public IList<string> Roles { get; set; }
}
}