-Code reformat

This commit is contained in:
James Newton-King
2013-10-20 15:08:39 +13:00
parent d03963016e
commit bcd6982419
466 changed files with 71645 additions and 71598 deletions
@@ -5,70 +5,70 @@ using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class JsonPropertyItemLevelSetting
{
#region Types
public class Business
public class JsonPropertyItemLevelSetting
{
public string Name { get; set; }
[JsonProperty(ItemIsReference = true)]
public IList<Employee> Employees { get; set; }
}
public class Employee
{
public string Name { get; set; }
[JsonProperty(IsReference = true)]
public Employee Manager { get; set; }
}
#endregion
public void Example()
{
#region Usage
Employee manager = new Employee
{
Name = "George-Michael"
};
Employee worker = new Employee
{
Name = "Maeby",
Manager = manager
};
Business business = new Business
#region Types
public class Business
{
Name = "Acme Ltd.",
Employees = new List<Employee>
public string Name { get; set; }
[JsonProperty(ItemIsReference = true)]
public IList<Employee> Employees { get; set; }
}
public class Employee
{
public string Name { get; set; }
[JsonProperty(IsReference = true)]
public Employee Manager { get; set; }
}
#endregion
public void Example()
{
#region Usage
Employee manager = new Employee
{
manager,
worker
}
};
Name = "George-Michael"
};
Employee worker = new Employee
{
Name = "Maeby",
Manager = manager
};
string json = JsonConvert.SerializeObject(business, Formatting.Indented);
Business business = new Business
{
Name = "Acme Ltd.",
Employees = new List<Employee>
{
manager,
worker
}
};
Console.WriteLine(json);
// {
// "Name": "Acme Ltd.",
// "Employees": [
// {
// "$id": "1",
// "Name": "George-Michael",
// "Manager": null
// },
// {
// "$id": "2",
// "Name": "Maeby",
// "Manager": {
// "$ref": "1"
// }
// }
// ]
// }
#endregion
string json = JsonConvert.SerializeObject(business, Formatting.Indented);
Console.WriteLine(json);
// {
// "Name": "Acme Ltd.",
// "Employees": [
// {
// "$id": "1",
// "Name": "George-Michael",
// "Manager": null
// },
// {
// "$id": "2",
// "Name": "Maeby",
// "Manager": {
// "$ref": "1"
// }
// }
// ]
// }
#endregion
}
}
}
}
}