public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as MedicationPrescription; if (dest != null) { base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (DateWrittenElement != null) { dest.DateWrittenElement = (Hl7.Fhir.Model.FhirDateTime)DateWrittenElement.DeepCopy(); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.MedicationPrescription.MedicationPrescriptionStatus>)StatusElement.DeepCopy(); } if (Patient != null) { dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy(); } if (Prescriber != null) { dest.Prescriber = (Hl7.Fhir.Model.ResourceReference)Prescriber.DeepCopy(); } if (Encounter != null) { dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy(); } if (Reason != null) { dest.Reason = (Hl7.Fhir.Model.Element)Reason.DeepCopy(); } if (NoteElement != null) { dest.NoteElement = (Hl7.Fhir.Model.FhirString)NoteElement.DeepCopy(); } if (Medication != null) { dest.Medication = (Hl7.Fhir.Model.ResourceReference)Medication.DeepCopy(); } if (DosageInstruction != null) { dest.DosageInstruction = new List <Hl7.Fhir.Model.MedicationPrescription.MedicationPrescriptionDosageInstructionComponent>(DosageInstruction.DeepCopy()); } if (Dispense != null) { dest.Dispense = (Hl7.Fhir.Model.MedicationPrescription.MedicationPrescriptionDispenseComponent)Dispense.DeepCopy(); } if (Substitution != null) { dest.Substitution = (Hl7.Fhir.Model.MedicationPrescription.MedicationPrescriptionSubstitutionComponent)Substitution.DeepCopy(); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as MedicationDispense; if (dest != null) { base.CopyTo(dest); if (Identifier != null) { dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopy(); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatus>)StatusElement.DeepCopy(); } if (Patient != null) { dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy(); } if (Dispenser != null) { dest.Dispenser = (Hl7.Fhir.Model.ResourceReference)Dispenser.DeepCopy(); } if (AuthorizingPrescription != null) { dest.AuthorizingPrescription = new List <Hl7.Fhir.Model.ResourceReference>(AuthorizingPrescription.DeepCopy()); } if (Dispense != null) { dest.Dispense = new List <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseDispenseComponent>(Dispense.DeepCopy()); } if (Substitution != null) { dest.Substitution = (Hl7.Fhir.Model.MedicationDispense.MedicationDispenseSubstitutionComponent)Substitution.DeepCopy(); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }