示例#1
0
        /// <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 !);
            }


            ((fhirCsR4.Models.DomainResource) this).SerializeJson(writer, options, false);

            if (SequenceType != null)
            {
                writer.WritePropertyName("sequenceType");
                SequenceType.SerializeJson(writer, options);
            }

            if (NumberOfSubunits != null)
            {
                writer.WriteNumber("numberOfSubunits", (int)NumberOfSubunits !);
            }

            if ((DisulfideLinkage != null) && (DisulfideLinkage.Count != 0))
            {
                writer.WritePropertyName("disulfideLinkage");
                writer.WriteStartArray();

                foreach (string valDisulfideLinkage in DisulfideLinkage)
                {
                    writer.WriteStringValue(valDisulfideLinkage);
                }

                writer.WriteEndArray();
            }

            if ((_DisulfideLinkage != null) && (_DisulfideLinkage.Count != 0))
            {
                writer.WritePropertyName("_disulfideLinkage");
                writer.WriteStartArray();

                foreach (Element val_DisulfideLinkage in _DisulfideLinkage)
                {
                    val_DisulfideLinkage.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Subunit != null) && (Subunit.Count != 0))
            {
                writer.WritePropertyName("subunit");
                writer.WriteStartArray();

                foreach (SubstanceProteinSubunit valSubunit in Subunit)
                {
                    valSubunit.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }