Example #1
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Subscription;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (CriteriaElement != null)
                {
                    dest.CriteriaElement = (Hl7.Fhir.Model.FhirString)CriteriaElement.DeepCopy();
                }
                if (Contact != null)
                {
                    dest.Contact = new List <Hl7.Fhir.Model.ContactPoint>(Contact.DeepCopy());
                }
                if (ReasonElement != null)
                {
                    dest.ReasonElement = (Hl7.Fhir.Model.FhirString)ReasonElement.DeepCopy();
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.Subscription.SubscriptionStatus>)StatusElement.DeepCopy();
                }
                if (ErrorElement != null)
                {
                    dest.ErrorElement = (Hl7.Fhir.Model.FhirString)ErrorElement.DeepCopy();
                }
                if (Channel != null)
                {
                    dest.Channel = (Hl7.Fhir.Model.Subscription.ChannelComponent)Channel.DeepCopy();
                }
                if (EndElement != null)
                {
                    dest.EndElement = (Hl7.Fhir.Model.Instant)EndElement.DeepCopy();
                }
                if (Tag != null)
                {
                    dest.Tag = new List <Hl7.Fhir.Model.Coding>(Tag.DeepCopy());
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
        // Converts the value of the element to a string representation.
        public static string ValueAsString(this Element element)
        {
            if (element.TypeOfElement == ElementType.Scalar)
            {
                return(ValueAsString((ScalarElement)element));
            }

            if (element.TypeOfElement == ElementType.Vector)
            {
                return(ValueAsString((VectorElement)element));
            }

            ErrorElement errorElement = element as ErrorElement;

            if ((object)errorElement != null)
            {
                return(ValueAsString(errorElement));
            }

            return(null);
        }
 // Converts the value of the element to a string representation.
 public static string ValueAsString(this ErrorElement element)
 {
     return(element.Exception.Message);
 }