TryReadElementFromXml method

  1. @override
Future<bool> TryReadElementFromXml(
  1. EwsServiceXmlReader reader
)
override
Tries to read element from XML. The reader.

Implementation

@override
Future<bool> TryReadElementFromXml(EwsServiceXmlReader reader) async {
  if (await super.TryReadElementFromXml(reader)) {
    return true;
  } else {
    switch (reader.LocalName) {
      case XmlElementNames.TimeOffset:
        this.timeOffset = EwsUtilities.XSDurationToTimeSpan(
            (await reader.ReadElementValue<String>())!);
        return true;
      case XmlElementNames.Month:
        this.month = await reader.ReadElementValue<int>();

        EwsUtilities.Assert(
            this.month! > 0 && this.month! <= 12,
            "AbsoluteMonthTransition.TryReadElementFromXml",
            "month is not in the valid 1 - 12 range.");

        return true;
      default:
        return false;
    }
  }
}