Base class contains a property that is hide by a new property in sub class but of different type. when deserializing, i am facing issue. I cann't change the name of the property in c# or json but can add namespace if possible.
namespace xyz
{
public class A
{
public ICollection<xyz.OrganizationAttribute> OrganizationAttributes { get; set; }
}
}
namespace pqr
{
public class AX : A
{
public new ICollection<pqr.OrganizationAttribute> OrganizationAttributes { get; set; }
}
}
Update:
JsonConvert.SerializeObject( axObject, new JsonSerializerSettings
{
PreserveReferencesHandling = PreserveReferencesHandling.Objects,
ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead,
DefaultValueHandling = DefaultValueHandling.Ignore
} );
JsonConvert.DeserializeObject<A>( "axjsonString", new JsonSerializerSettings
{
MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead
} );
Any help is appreciated. Thanks