/// <inheritdoc/>
        void IXmlSerializable.ReadXml(XmlReader reader)
        {
            Preconditions.CheckParameterNotNull(reader, nameof(reader));
            string yearText = reader.ReadElementContentAsString();
            var    yearNum  = int.Parse(yearText);

            this = new CalendarYear(yearNum);
        }
Example #2
0
        /// <inheritdoc/>
        void IXmlSerializable.ReadXml(XmlReader reader)
        {
            Preconditions.CheckParameterNotNull(reader, nameof(reader));
            string valueText = reader.ReadElementContentAsString();

#if NET40
            this = Parse(valueText);
#else
            Unsafe.AsRef(this) = Parse(valueText);
#endif
        }
Example #3
0
 /// <inheritdoc/>
 void IXmlSerializable.WriteXml(XmlWriter writer)
 {
     Preconditions.CheckParameterNotNull(writer, nameof(writer));
     writer.WriteString(ToString());
 }
 /// <inheritdoc/>
 void IXmlSerializable.WriteXml(XmlWriter writer)
 {
     Preconditions.CheckParameterNotNull(writer, nameof(writer));
     writer.WriteString(Year.ToString("D", CultureInfo.InvariantCulture)); // Same as ToString, but ToString contract does not assume culture invariance
 }