protected override IList <JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization) { var properties = base.CreateProperties(type, memberSerialization); foreach (var p in properties.ToArray()) { // ICopyFrom properties are always Writable, and should not attempt to set the value directly. if (typeof(ICopyFrom).IsAssignableFrom(p.PropertyType)) { p.Writable = true; p.ValueProvider = new DeserializeToExistingValueProvider(p.ValueProvider); p.ObjectCreationHandling = ObjectCreationHandling.Reuse; } // Fixable properties need to have a second 'virtual' property to support #prefix. if (p.PropertyType.IsConstructedGenericType && p.PropertyType.GetGenericTypeDefinition() == typeof(Fixable <>)) { // ShouldSerialize for Fixable<> properties is smuggled in via the // ShouldDeserialize delegate. (trying to think of a workaround) var newp = new JsonProperty(); newp.LoadFrom(p); newp.PropertyName = $"#{p.PropertyName}"; newp.ShouldSerialize = p.ShouldDeserialize; // should always deserialize (fix smuggling) newp.ShouldDeserialize = o => true; p.ShouldDeserialize = o => true; // add the virtual property properties.Add(newp); } } return(properties); }