-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
59 lines (51 loc) · 1.6 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
52
53
54
55
56
57
58
59
using System;
using System.Collections.Generic;
namespace Scenario1
{
class Program
{
static void Main(string[] args)
{
Account account = GetAccount();
Console.WriteLine(Serialize(account));
Console.WriteLine(SerializePrettyPrint(account));
Console.WriteLine("Press any key to continue ...");
Console.ReadLine();
}
// TODO: 1) Serialize the "account" object to a JSON string and return it.
private static string Serialize(Account account)
{
// <Add/modify code here>
return "";
}
// TODO: 2) Serialize the "account" object to a "pretty-printed" JSON string and return it.
private static string SerializePrettyPrint(Account account)
{
// <Add/modify code here>
return "";
}
private static Account GetAccount()
{
// Note: Do NOT modify the Account object creation.
Account account = new Account
{
Email = "[email protected]",
Active = true,
CreatedDate = new DateTime(2013, 1, 20, 0, 0, 0, DateTimeKind.Utc),
Roles = new List<string>
{
"User",
"Admin"
}
};
return account;
}
}
public class Account
{
public string Email { get; set; }
public bool Active { get; set; }
public DateTime CreatedDate { get; set; }
public IList<string> Roles { get; set; }
}
}