/// <summary> /// To convert a JSON string into an object /// </summary> /// <param name="reader">JSON reader</param> /// <param name="objectType">Object type</param> /// <param name="existingValue">Existing value</param> /// <param name="serializer">JSON Serializer</param> /// <returns>The object converted from the JSON string</returns> public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { return(Pig.FromJson(JObject.Load(reader).ToString(Formatting.None))); }
/// <summary> /// Initializes a new instance of the <see cref="Mammal" /> class /// with the <see cref="Pig" /> class /// </summary> /// <param name="actualInstance">An instance of Pig.</param> public Mammal(Pig actualInstance) { this.IsNullable = false; this.SchemaType = "oneOf"; this.ActualInstance = actualInstance ?? throw new ArgumentException("Invalid instance found. Must not be null."); }
/// <summary> /// Initializes a new instance of the <see cref="Mammal" /> class. /// </summary> /// <param name="pig">pig</param> public Mammal(Pig pig) { Pig = pig; }