public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as Account; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } 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.Account.AccountStatus>)StatusElement.DeepCopy(); } if (Type != null) { dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy(); } if (NameElement != null) { dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy(); } if (Subject != null) { dest.Subject = new List <Hl7.Fhir.Model.ResourceReference>(Subject.DeepCopy()); } if (ServicePeriod != null) { dest.ServicePeriod = (Hl7.Fhir.Model.Period)ServicePeriod.DeepCopy(); } if (Coverage != null) { dest.Coverage = new List <Hl7.Fhir.Model.Account.CoverageComponent>(Coverage.DeepCopy()); } if (Owner != null) { dest.Owner = (Hl7.Fhir.Model.ResourceReference)Owner.DeepCopy(); } if (DescriptionElement != null) { dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopy(); } if (Guarantor != null) { dest.Guarantor = new List <Hl7.Fhir.Model.Account.GuarantorComponent>(Guarantor.DeepCopy()); } if (PartOf != null) { dest.PartOf = (Hl7.Fhir.Model.ResourceReference)PartOf.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 !); } ((Fhir.R4.Models.DomainResource) this).SerializeJson(writer, options, false); if ((Identifier != null) && (Identifier.Count != 0)) { writer.WritePropertyName("identifier"); writer.WriteStartArray(); foreach (Identifier valIdentifier in Identifier) { valIdentifier.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (!string.IsNullOrEmpty(Status)) { writer.WriteString("status", (string)Status !); } if (_Status != null) { writer.WritePropertyName("_status"); _Status.SerializeJson(writer, options); } if (Type != null) { writer.WritePropertyName("type"); Type.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Name)) { writer.WriteString("name", (string)Name !); } if (_Name != null) { writer.WritePropertyName("_name"); _Name.SerializeJson(writer, options); } if ((Subject != null) && (Subject.Count != 0)) { writer.WritePropertyName("subject"); writer.WriteStartArray(); foreach (Reference valSubject in Subject) { valSubject.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (ServicePeriod != null) { writer.WritePropertyName("servicePeriod"); ServicePeriod.SerializeJson(writer, options); } if ((Coverage != null) && (Coverage.Count != 0)) { writer.WritePropertyName("coverage"); writer.WriteStartArray(); foreach (AccountCoverage valCoverage in Coverage) { valCoverage.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Owner != null) { writer.WritePropertyName("owner"); Owner.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(Description)) { writer.WriteString("description", (string)Description !); } if (_Description != null) { writer.WritePropertyName("_description"); _Description.SerializeJson(writer, options); } if ((Guarantor != null) && (Guarantor.Count != 0)) { writer.WritePropertyName("guarantor"); writer.WriteStartArray(); foreach (AccountGuarantor valGuarantor in Guarantor) { valGuarantor.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (PartOf != null) { writer.WritePropertyName("partOf"); PartOf.SerializeJson(writer, options); } if (includeStartObject) { writer.WriteEndObject(); } }
/// <inheritdoc/> public string ToDelimitedString() { CultureInfo culture = CultureInfo.CurrentCulture; return(string.Format( culture, StringHelper.StringFormatSequence(0, 4, Configuration.FieldSeparator), Id, TrayType?.ToDelimitedString(), ServicePeriod != null ? string.Join(Configuration.FieldRepeatSeparator, ServicePeriod.Select(x => x.ToDelimitedString())) : null, TextInstruction ).TrimEnd(Configuration.FieldSeparator.ToCharArray())); }