コード例 #1
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as HumanName;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (UseElement != null)
                {
                    dest.UseElement = (Code <Hl7.Fhir.Model.HumanName.NameUse>)UseElement.DeepCopy();
                }
                if (TextElement != null)
                {
                    dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopy();
                }
                if (FamilyElement != null)
                {
                    dest.FamilyElement = new List <Hl7.Fhir.Model.FhirString>(FamilyElement.DeepCopy());
                }
                if (GivenElement != null)
                {
                    dest.GivenElement = new List <Hl7.Fhir.Model.FhirString>(GivenElement.DeepCopy());
                }
                if (PrefixElement != null)
                {
                    dest.PrefixElement = new List <Hl7.Fhir.Model.FhirString>(PrefixElement.DeepCopy());
                }
                if (SuffixElement != null)
                {
                    dest.SuffixElement = new List <Hl7.Fhir.Model.FhirString>(SuffixElement.DeepCopy());
                }
                if (Period != null)
                {
                    dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopy();
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
コード例 #2
0
        public override ErrorList Validate()
        {
            var result = new ErrorList();

            result.AddRange(base.Validate());

            if (UseElement != null)
            {
                result.AddRange(UseElement.Validate());
            }
            if (TextElement != null)
            {
                result.AddRange(TextElement.Validate());
            }
            if (FamilyElement != null)
            {
                FamilyElement.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (GivenElement != null)
            {
                GivenElement.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (PrefixElement != null)
            {
                PrefixElement.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (SuffixElement != null)
            {
                SuffixElement.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Period != null)
            {
                result.AddRange(Period.Validate());
            }

            return(result);
        }