-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
@@ -7,35 +7,35 @@ using File = System.IO.File;
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class SerializeWithJsonSerializerToFile
{
#region Types
public class Movie
public class SerializeWithJsonSerializerToFile
{
public string Name { get; set; }
public int Year { get; set; }
}
#endregion
public void Example()
{
#region Usage
Movie movie = new Movie
#region Types
public class Movie
{
Name = "Bad Boys",
Year = 1995
};
public string Name { get; set; }
public int Year { get; set; }
}
#endregion
// serialize JSON to a string and then write string to a file
File.WriteAllText(@"c:\movie.json", JsonConvert.SerializeObject(movie));
public void Example()
{
#region Usage
Movie movie = new Movie
{
Name = "Bad Boys",
Year = 1995
};
// serialize JSON directly to a file
using (StreamWriter file = File.CreateText(@"c:\movie.json"))
{
JsonSerializer serializer = new JsonSerializer();
serializer.Serialize(file, movie);
}
#endregion
// serialize JSON to a string and then write string to a file
File.WriteAllText(@"c:\movie.json", JsonConvert.SerializeObject(movie));
// serialize JSON directly to a file
using (StreamWriter file = File.CreateText(@"c:\movie.json"))
{
JsonSerializer serializer = new JsonSerializer();
serializer.Serialize(file, movie);
}
#endregion
}
}
}
}