-
Notifications
You must be signed in to change notification settings - Fork 446
/
Copy pathUser.cs
40 lines (31 loc) · 1.01 KB
/
User.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
using System.IO;
using System.Text.Json;
using System.Text.Json.Serialization;
using WebApiClientCore.Serialization;
namespace WebApiClientCore.Benchmarks
{
public class User
{
[JsonPropertyName("id")]
public int Id { get; set; }
[JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("bio")]
public string Bio { get; set; }
[JsonPropertyName("followers")]
public int Followers { get; set; }
[JsonPropertyName("following")]
public int Following { get; set; }
[JsonPropertyName("url")]
public string Url { get; set; }
public static User Instance { get; }
public static byte[] Utf8Json { get; }
public static string XmlString { get; set; }
static User()
{
Utf8Json = File.ReadAllBytes("user.json");
Instance = JsonSerializer.Deserialize<User>(Utf8Json);
XmlString = XmlSerializer.Serialize(Instance, null);
}
}
}