using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
string SecretProperty { get; set; }
string Include { get; set; }
public string SecretProperty { get; set; }
public string Include { get; set; }
public static void Test()
SecretProperty = "Ignore Me",
var json = JsonConvert.SerializeObject(root);
Assert.IsTrue(json == "{\"Include\":\"Include Me\"}");
var resolver = new DefaultContractResolver();
var contract = resolver.ResolveContract(typeof(Foo));
Console.WriteLine("Contract for {0}: {1}", typeof(Foo), contract);
Console.WriteLine(string.Join("\n", ((JsonObjectContract)contract).Properties.Select(p => string.Format(" {0}: Ignored={1}", p, p.Ignored))));
public static void Main()
Console.WriteLine("Environment version: " + Environment.Version);
Console.WriteLine("Json.NET version: " + typeof(JsonSerializer).Assembly.FullName);
Console.WriteLine("Failed with unhandled exception: ");