-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
@@ -6,51 +6,51 @@ using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class DeserializeConstructorHandling
{
#region Types
public class Website
public class DeserializeConstructorHandling
{
public string Url { get; set; }
private Website()
{
}
public Website(Website website)
{
if (website == null)
throw new ArgumentNullException("website");
Url = website.Url;
}
}
#endregion
public void Example()
{
#region Usage
string json = @"{'Url':'http://www.google.com'}";
try
{
JsonConvert.DeserializeObject<Website>(json);
}
catch (TargetInvocationException ex)
{
Console.WriteLine(ex);
// Value cannot be null.
// Parameter name: website
}
Website website = JsonConvert.DeserializeObject<Website>(json, new JsonSerializerSettings
#region Types
public class Website
{
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor
});
public string Url { get; set; }
Console.WriteLine(website.Url);
// http://www.google.com
#endregion
private Website()
{
}
public Website(Website website)
{
if (website == null)
throw new ArgumentNullException("website");
Url = website.Url;
}
}
#endregion
public void Example()
{
#region Usage
string json = @"{'Url':'http://www.google.com'}";
try
{
JsonConvert.DeserializeObject<Website>(json);
}
catch (TargetInvocationException ex)
{
Console.WriteLine(ex);
// Value cannot be null.
// Parameter name: website
}
Website website = JsonConvert.DeserializeObject<Website>(json, new JsonSerializerSettings
{
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor
});
Console.WriteLine(website.Url);
// http://www.google.com
#endregion
}
}
}
}