/// <summary>
 /// Initializes a new instance of the <see cref="ExtendedAddress"/> class.
 /// </summary>
 /// <param name="streetAddress">XAD.1 - Street Address.</param>
 /// <param name="city">XAD.3 - City.</param>
 /// <param name="stateOrProvince">XAD.4 - State or Province.</param>
 /// <param name="zipOrPostalCode">XAD.5 - Zip or Postal Code.</param>
 public ExtendedAddress(StreetAddress streetAddress, string city, string stateOrProvince, string zipOrPostalCode)
 {
     StreetAddress   = streetAddress;
     City            = city;
     StateOrProvince = stateOrProvince;
     ZipOrPostalCode = zipOrPostalCode;
 }
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            System.Globalization.CultureInfo culture = System.Globalization.CultureInfo.CurrentCulture;
            string separator = IsSubcomponent ? Configuration.SubcomponentSeparator : Configuration.ComponentSeparator;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 23, separator),
                       StreetAddress?.ToDelimitedString(),
                       OtherDesignation,
                       City,
                       StateOrProvince,
                       ZipOrPostalCode,
                       Country,
                       AddressType,
                       OtherGeographicDesignation,
                       CountyParishCode?.ToDelimitedString(),
                       CensusTract,
                       AddressRepresentationCode,
                       AddressValidityRange?.ToDelimitedString(),
                       EffectiveDate.HasValue ? EffectiveDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ExpirationDate.HasValue ? ExpirationDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       ExpirationReason?.ToDelimitedString(),
                       TemporaryIndicator,
                       BadAddressIndicator,
                       AddressUsage,
                       Addressee,
                       Comment,
                       PreferenceOrder.HasValue ? PreferenceOrder.Value.ToString(Consts.NumericFormat, culture) : null,
                       ProtectionCode?.ToDelimitedString(),
                       AddressIdentifier?.ToDelimitedString()
                       ).TrimEnd(separator.ToCharArray()));
        }