public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as MedicinalProductIndication; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (Subject != null) { dest.Subject = new List <Hl7.Fhir.Model.ResourceReference>(Subject.DeepCopy()); } if (DiseaseSymptomProcedure != null) { dest.DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableConcept)DiseaseSymptomProcedure.DeepCopy(); } if (DiseaseStatus != null) { dest.DiseaseStatus = (Hl7.Fhir.Model.CodeableConcept)DiseaseStatus.DeepCopy(); } if (Comorbidity != null) { dest.Comorbidity = new List <Hl7.Fhir.Model.CodeableConcept>(Comorbidity.DeepCopy()); } if (IntendedEffect != null) { dest.IntendedEffect = (Hl7.Fhir.Model.CodeableConcept)IntendedEffect.DeepCopy(); } if (Duration != null) { dest.Duration = (Hl7.Fhir.Model.Quantity)Duration.DeepCopy(); } if (OtherTherapy != null) { dest.OtherTherapy = new List <Hl7.Fhir.Model.MedicinalProductIndication.OtherTherapyComponent>(OtherTherapy.DeepCopy()); } if (UndesirableEffect != null) { dest.UndesirableEffect = new List <Hl7.Fhir.Model.ResourceReference>(UndesirableEffect.DeepCopy()); } if (Population != null) { dest.Population = new List <Hl7.Fhir.Model.Population>(Population.DeepCopy()); } return(dest); }
/// <summary> /// Serialize to a JSON object /// </summary> public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } if (!string.IsNullOrEmpty(ResourceType)) { writer.WriteString("resourceType", (string)ResourceType !); } ((fhirCsR4.Models.DomainResource) this).SerializeJson(writer, options, false); if ((Subject != null) && (Subject.Count != 0)) { writer.WritePropertyName("subject"); writer.WriteStartArray(); foreach (Reference valSubject in Subject) { valSubject.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (DiseaseSymptomProcedure != null) { writer.WritePropertyName("diseaseSymptomProcedure"); DiseaseSymptomProcedure.SerializeJson(writer, options); } if (DiseaseStatus != null) { writer.WritePropertyName("diseaseStatus"); DiseaseStatus.SerializeJson(writer, options); } if ((Comorbidity != null) && (Comorbidity.Count != 0)) { writer.WritePropertyName("comorbidity"); writer.WriteStartArray(); foreach (CodeableConcept valComorbidity in Comorbidity) { valComorbidity.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (IntendedEffect != null) { writer.WritePropertyName("intendedEffect"); IntendedEffect.SerializeJson(writer, options); } if (Duration != null) { writer.WritePropertyName("duration"); Duration.SerializeJson(writer, options); } if ((OtherTherapy != null) && (OtherTherapy.Count != 0)) { writer.WritePropertyName("otherTherapy"); writer.WriteStartArray(); foreach (MedicinalProductIndicationOtherTherapy valOtherTherapy in OtherTherapy) { valOtherTherapy.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((UndesirableEffect != null) && (UndesirableEffect.Count != 0)) { writer.WritePropertyName("undesirableEffect"); writer.WriteStartArray(); foreach (Reference valUndesirableEffect in UndesirableEffect) { valUndesirableEffect.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Population != null) && (Population.Count != 0)) { writer.WritePropertyName("population"); writer.WriteStartArray(); foreach (Population valPopulation in Population) { valPopulation.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (includeStartObject) { writer.WriteEndObject(); } }