-Samples!

This commit is contained in:
James Newton-King
2013-01-28 23:20:05 +13:00
parent 849f7a9fa8
commit 1c0e2856c2
208 changed files with 713 additions and 693 deletions
@@ -57,7 +57,7 @@ namespace Newtonsoft.Json.Tests.Documentation
'item': [
{
'title': 'Json.NET 1.3 + New license + Now on CodePlex',
'description': 'Annoucing the release of Json.NET 1.3, the MIT license and the source being available on CodePlex',
'description': 'Annoucing the release of Json.NET 1.3, the MIT license and the source on CodePlex',
'link': 'http://james.newtonking.com/projects/json-net.aspx',
'category': [
'Json.NET',
@@ -263,7 +263,7 @@ namespace Newtonsoft.Json.Tests.Documentation
'item': [
{
'title': 'Json.NET 1.3 + New license + Now on CodePlex',
'description': 'Annoucing the release of Json.NET 1.3, the MIT license and the source being available on CodePlex',
'description': 'Annoucing the release of Json.NET 1.3, the MIT license and the source on CodePlex',
'link': 'http://james.newtonking.com/projects/json-net.aspx',
'categories': [
'Json.NET',
@@ -5,7 +5,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Bson;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Bson
namespace Newtonsoft.Json.Tests.Documentation.Samples.Bson
{
public class DeserializeFromBson
{
@@ -5,7 +5,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Bson;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Bson
namespace Newtonsoft.Json.Tests.Documentation.Samples.Bson
{
public class DeserializeFromBsonCollection
{
@@ -19,8 +19,24 @@ namespace Newtonsoft.Json.Tests.Documentation.Examples.Bson
public void Example()
{
//IList<Event> e = new List<Event>
// {
// new Event {StartDate = new DateTime(2013, 3, 31), Name = "Easter"}
// };
//MemoryStream ms1 = new MemoryStream();
//using (BsonWriter writer = new BsonWriter(ms1))
//{
// JsonSerializer serializer = new JsonSerializer();
// serializer.Serialize(writer, e);
//}
//string ss = Convert.ToBase64String(ms1.ToArray());
//Console.WriteLine(ss);
#region Usage
byte[] data = Convert.FromBase64String("awAAAAMwADAAAAACTmFtZQAOAAAATW92aWUgcHJlbWllcgAJU3RhcnREYXRlAMDgKWE8AQAAAAMxADAAAAACTmFtZQAOAAAATW92aWUgcHJlbWllcgAJU3RhcnREYXRlAMDgKWE8AQAAAAA=");
string s = "MQAAAAMwACkAAAACTmFtZQAHAAAARWFzdGVyAAlTdGFydERhdGUAgDf0uj0BAAAAAA==";
byte[] data = Convert.FromBase64String(s);
MemoryStream ms = new MemoryStream(data);
using (BsonReader reader = new BsonReader(ms))
@@ -32,7 +48,10 @@ namespace Newtonsoft.Json.Tests.Documentation.Examples.Bson
IList<Event> events = serializer.Deserialize<IList<Event>>(reader);
Console.WriteLine(events.Count);
// 2
// 1
Console.WriteLine(events[0].Name);
// Easter
}
#endregion
}
@@ -6,7 +6,7 @@ using System.Text;
using Newtonsoft.Json.Bson;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Bson
namespace Newtonsoft.Json.Tests.Documentation.Samples.Bson
{
public class SerializeToBson
{
@@ -4,7 +4,7 @@ using System.IO;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Json
namespace Newtonsoft.Json.Tests.Documentation.Samples.Json
{
public class ReadJsonWithJsonTextReader
{
@@ -4,7 +4,7 @@ using System.IO;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Json
namespace Newtonsoft.Json.Tests.Documentation.Samples.Json
{
public class WriteJsonWithJsonTextWriter
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class Clone
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class CreateJsonAnonymousObject
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class CreateJsonCollectionInitializer
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class CreateJsonDeclaratively
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class CreateJsonDynamic
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class CreateJsonJTokenWriter
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class CreateJsonManually
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class CreateReader
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class CreateWriter
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class DeepEquals
{
@@ -5,7 +5,7 @@ using System.Text;
using System.Web;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class DeserializeWithLinq
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class FromObject
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class JObjectProperties
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class JValueCast
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class JValueValue
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class ModifyJson
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class ParseJsonAny
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class ParseJsonArray
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class ParseJsonObject
{
@@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class QueryJson
{
@@ -19,7 +19,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
'item': [
{
'title': 'Json.NET 1.3 + New license + Now on CodePlex',
'description': 'Annoucing the release of Json.NET 1.3, the MIT license and the source being available on CodePlex',
'description': 'Annoucing the release of Json.NET 1.3, the MIT license and the source on CodePlex',
'link': 'http://james.newtonking.com/projects/json-net.aspx',
'category': [
'Json.NET',
@@ -5,7 +5,7 @@ using System.Text;
using System.Web;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class QueryJsonDynamic
{
@@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class QueryJsonLinq
{
@@ -19,7 +19,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
'item': [
{
'title': 'Json.NET 1.3 + New license + Now on CodePlex',
'description': 'Annoucing the release of Json.NET 1.3, the MIT license and the source being available on CodePlex',
'description': 'Annoucing the release of Json.NET 1.3, the MIT license and the source on CodePlex',
'link': 'http://james.newtonking.com/projects/json-net.aspx',
'category': [
'Json.NET',
@@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class QueryJsonSelectToken
{
@@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class QueryJsonSelectTokenWithLinq
{
@@ -47,7 +47,8 @@ namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
Console.WriteLine(string.Join(", ", storeNames));
// Lambton Quay, Willis Street
IList<string> firstProductNames = o["Manufacturers"].Select(m => (string)m.SelectToken("Products[1].Name")).Where(n => n != null).ToList();
IList<string> firstProductNames = o["Manufacturers"].Select(m => (string)m.SelectToken("Products[1].Name"))
.Where(n => n != null).ToList();
Console.WriteLine(string.Join(", ", firstProductNames));
// Headlight Fluid
@@ -6,7 +6,7 @@ using System.IO;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class ReadJTokenFromBson
{
@@ -5,7 +5,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class ReadJson
{
@@ -5,7 +5,7 @@ using System.Text;
using System.Web;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class SerializeWithLinq
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class ToObjectComplex
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class ToObjectGeneric
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class ToObjectType
{
@@ -5,7 +5,7 @@ using System.Text;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class ToString
{
@@ -5,7 +5,7 @@ using System.Text;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class ToStringJsonConverter
{
@@ -6,7 +6,7 @@ using System.IO;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class WriteJTokenToBson
{
@@ -5,7 +5,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Linq
namespace Newtonsoft.Json.Tests.Documentation.Samples.Linq
{
public class WriteToJsonFile
{
@@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Schema
namespace Newtonsoft.Json.Tests.Documentation.Samples.Schema
{
public class CreateJsonSchemaManually
{
@@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Schema
namespace Newtonsoft.Json.Tests.Documentation.Samples.Schema
{
public class JTokenIsValid
{
@@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Schema
namespace Newtonsoft.Json.Tests.Documentation.Samples.Schema
{
public class JTokenIsValidWithMessages
{
@@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Schema
namespace Newtonsoft.Json.Tests.Documentation.Samples.Schema
{
public class JTokenValidateWithEvent
{
@@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Schema
namespace Newtonsoft.Json.Tests.Documentation.Samples.Schema
{
public class JsonSchemaParse
{
@@ -5,7 +5,7 @@ using System.IO;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Schema
namespace Newtonsoft.Json.Tests.Documentation.Samples.Schema
{
public class JsonValidatingReaderAndSerializer
{
@@ -5,7 +5,7 @@ using System.IO;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Schema
namespace Newtonsoft.Json.Tests.Documentation.Samples.Schema
{
public class LoadJsonSchemaFromFile
{
@@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Schema
namespace Newtonsoft.Json.Tests.Documentation.Samples.Schema
{
public class RefJsonSchemaResolver
{
@@ -5,7 +5,7 @@ using System.IO;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Schema
namespace Newtonsoft.Json.Tests.Documentation.Samples.Schema
{
public class SaveJsonSchemaToFile
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Serialization;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class CustomContractResolver
{
@@ -4,14 +4,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class CustomJsonConverter
{
#region Types
public class KeysJsonConverter : JsonConverter
{
private Type[] _types;
private readonly Type[] _types;
public KeysJsonConverter(params Type[] types)
{
@@ -39,7 +39,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
throw new NotImplementedException("This is not necessary because CanRead is false so the type will be deserialized as normal.");
throw new NotImplementedException("Unnecessary because CanRead is false. The type will skip the converter.");
}
public override bool CanRead
@@ -5,7 +5,7 @@ using System.Diagnostics;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class CustomTraceWriter
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class DataContractAndDataMember
{
@@ -4,7 +4,7 @@ using System.ComponentModel;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class DefaultValueAttributeIgnore
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class DefaultValueHandlingIgnore
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class DeserializeAnonymousType
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class DeserializeCollection
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Reflection;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class DeserializeConstructorHandling
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Converters;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class DeserializeCustomCreationConverter
{
@@ -5,7 +5,7 @@ using System.Linq;
using System.Text;
using NUnit.Framework;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class DeserializeDataSet
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class DeserializeDictionary
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class DeserializeMissingMemberHandling
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class DeserializeObject
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class DeserializeObjectCreationHandling
{
@@ -5,7 +5,7 @@ using System.Linq;
using System.Text;
using File = System.IO.File;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class DeserializeWithJsonSerializerFromFile
{
@@ -5,7 +5,7 @@ using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class ErrorHandlingAttribute
{
@@ -5,7 +5,7 @@ using System.Text;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class ErrorHandlingEvent
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Converters;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class JsonConverterAttributeClass
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Converters;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class JsonConverterAttributeProperty
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class JsonObjectAttributeOptIn
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Collections;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class JsonObjectAttributeOverrideIEnumerable
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class JsonPropertyItemLevelSetting
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class JsonPropertyName
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class JsonPropertyOrder
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class JsonPropertyPropertyLevelSetting
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class JsonPropertyRequired
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class MaxDepth
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class NullValueHandlingIgnore
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class PopulateObject
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class PreserveReferencesHandlingObject
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class PropertyJsonIgnore
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class ReferenceLoopHandlingIgnore
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class SerializationCallbackAttributes
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class SerializeCollection
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class SerializeConditionalProperty
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Serialization;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class SerializeContractResolver
{
@@ -5,7 +5,7 @@ using System.Linq;
using System.Text;
using NUnit.Framework;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class SerializeDataSet
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class SerializeDateFormatHandling
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class SerializeDateTimeZoneHandling
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class SerializeDictionary
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class SerializeObject
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class SerializeRawJson
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class SerializeSerializationBinder
{
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class SerializeTypeNameHandling
{
@@ -48,13 +48,13 @@ namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
Console.WriteLine(jsonTypeNameAll);
// {
// "$type": "Newtonsoft.Json.Tests.Documentation.Examples.SerializeTypeNameHandling+Stockholder, Newtonsoft.Json.Tests",
// "$type": "Newtonsoft.Json.Samples.Stockholder, Newtonsoft.Json.Tests",
// "FullName": "Steve Stockholder",
// "Businesses": {
// "$type": "System.Collections.Generic.List`1[[Newtonsoft.Json.Tests.Documentation.Examples.SerializeTypeNameHandling+Business, Newtonsoft.Json.Tests]], mscorlib",
// "$type": "System.Collections.Generic.List`1[[Newtonsoft.Json.Samples.Business, Newtonsoft.Json.Tests]], mscorlib",
// "$values": [
// {
// "$type": "Newtonsoft.Json.Tests.Documentation.Examples.SerializeTypeNameHandling+Hotel, Newtonsoft.Json.Tests",
// "$type": "Newtonsoft.Json.Samples.Hotel, Newtonsoft.Json.Tests",
// "Stars": 4,
// "Name": "Hudson Hotel"
// }
@@ -72,7 +72,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
// "FullName": "Steve Stockholder",
// "Businesses": [
// {
// "$type": "Newtonsoft.Json.Tests.Documentation.Examples.SerializeTypeNameHandling+Hotel, Newtonsoft.Json.Tests",
// "$type": "Newtonsoft.Json.Samples.Hotel, Newtonsoft.Json.Tests",
// "Stars": 4,
// "Name": "Hudson Hotel"
// }
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class SerializeUnindentedJson
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Converters;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class SerializeWithJsonConverters
{
@@ -27,7 +27,9 @@ namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
Console.WriteLine(jsonWithConverter);
// ["CurrentCulture","InvariantCulture"]
List<StringComparison> newStringComparsions = JsonConvert.DeserializeObject<List<StringComparison>>(jsonWithConverter, new StringEnumConverter());
List<StringComparison> newStringComparsions = JsonConvert.DeserializeObject<List<StringComparison>>(
jsonWithConverter,
new StringEnumConverter());
Console.WriteLine(string.Join(", ", newStringComparsions.Select(c => c.ToString())));
// CurrentCulture, InvariantCulture
@@ -5,7 +5,7 @@ using System.Linq;
using System.Text;
using File = System.IO.File;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class SerializeWithJsonSerializerToFile
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Serialization;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Serializer
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
{
public class TraceWriter
{
@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Xml.Linq;
namespace Newtonsoft.Json.Tests.Documentation.Examples.Xml
namespace Newtonsoft.Json.Tests.Documentation.Samples.Xml
{
public class ConvertJsonToXml
{

Some files were not shown because too many files have changed in this diff Show More