-Examples!
This commit is contained in:
@@ -7,6 +7,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
|
||||
{
|
||||
public class PopulateObject
|
||||
{
|
||||
#region Types
|
||||
public class Account
|
||||
{
|
||||
public string Email { get; set; }
|
||||
@@ -14,9 +15,11 @@ namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
|
||||
public DateTime CreatedDate { get; set; }
|
||||
public IList<string> Roles { get; set; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
public void Example()
|
||||
{
|
||||
#region Usage
|
||||
Account account = new Account
|
||||
{
|
||||
Email = "james@example.com",
|
||||
@@ -30,9 +33,9 @@ namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
|
||||
};
|
||||
|
||||
string json = @"{
|
||||
""Active"": false,
|
||||
""Roles"": [
|
||||
""Expired""
|
||||
'Active': false,
|
||||
'Roles': [
|
||||
'Expired'
|
||||
]
|
||||
}";
|
||||
|
||||
@@ -46,6 +49,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
|
||||
|
||||
Console.WriteLine(string.Join(", ", account.Roles));
|
||||
// User, Admin, Expired
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user