TryReadElementFromXml method

  1. @override
Future<bool> TryReadElementFromXml(
  1. EwsServiceXmlReader reader
)
override
Defines an implicit conversion between a String representing an SMTP address and Mailbox. The SMTP address to convert to EmailAddress. Tries to read element from XML. The reader.

Implementation

// static implicit operator Mailbox(String smtpAddress)
//        {
//            return new Mailbox(smtpAddress);
//        }

/// <summary>
/// Tries to read element from XML.
/// </summary>
/// <param name="reader">The reader.</param>
/// <returns>True if element was read.</returns>
@override
Future<bool> TryReadElementFromXml(EwsServiceXmlReader reader) async {
  switch (reader.LocalName) {
    case XmlElementNames.EmailAddress:
      this.Address = await reader.ReadElementValue<String>();
      return true;
    case XmlElementNames.RoutingType:
      this.RoutingType = await reader.ReadElementValue<String>();
      return true;
    default:
      return false;
  }
}