public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as Specimen; if (dest != null) { base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.Specimen.SpecimenStatus>)StatusElement.DeepCopy(); } if (Type != null) { dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy(); } if (Parent != null) { dest.Parent = new List <Hl7.Fhir.Model.ResourceReference>(Parent.DeepCopy()); } if (Subject != null) { dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy(); } if (AccessionIdentifier != null) { dest.AccessionIdentifier = (Hl7.Fhir.Model.Identifier)AccessionIdentifier.DeepCopy(); } if (ReceivedTimeElement != null) { dest.ReceivedTimeElement = (Hl7.Fhir.Model.FhirDateTime)ReceivedTimeElement.DeepCopy(); } if (Collection != null) { dest.Collection = (Hl7.Fhir.Model.Specimen.CollectionComponent)Collection.DeepCopy(); } if (Treatment != null) { dest.Treatment = new List <Hl7.Fhir.Model.Specimen.TreatmentComponent>(Treatment.DeepCopy()); } if (Container != null) { dest.Container = new List <Hl7.Fhir.Model.Specimen.ContainerComponent>(Container.DeepCopy()); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }
public override ErrorList Validate() { var result = new ErrorList(); result.AddRange(base.Validate()); if (Identifier != null) { result.AddRange(Identifier.Validate()); } if (Type != null) { result.AddRange(Type.Validate()); } if (Source != null) { Source.ForEach(elem => result.AddRange(elem.Validate())); } if (Subject != null) { result.AddRange(Subject.Validate()); } if (AccessionIdentifier != null) { AccessionIdentifier.ForEach(elem => result.AddRange(elem.Validate())); } if (ReceivedTimeElement != null) { result.AddRange(ReceivedTimeElement.Validate()); } if (Collection != null) { result.AddRange(Collection.Validate()); } if (Treatment != null) { Treatment.ForEach(elem => result.AddRange(elem.Validate())); } if (Container != null) { Container.ForEach(elem => result.AddRange(elem.Validate())); } return(result); }