TryLoadFromXml static method

Future<bool> TryLoadFromXml(
  1. EwsServiceXmlReader reader,
  2. OutParam<PropertyDefinitionBase> propertyDefinitionOutParam
)
Tries to load from XML. The reader. The property definition.

Implementation

static Future<bool> TryLoadFromXml(
  EwsServiceXmlReader reader,
  OutParam<PropertyDefinitionBase> propertyDefinitionOutParam,
) async {
  switch (reader.LocalName) {
    case XmlElementNames.FieldURI:
      propertyDefinitionOutParam.param =
          ServiceObjectSchema.FindPropertyDefinition(
            reader.ReadAttributeValue(XmlAttributeNames.FieldURI),
          );
      await reader.SkipCurrentElement();
      return true;
    case XmlElementNames.IndexedFieldURI:
      propertyDefinitionOutParam.param = IndexedPropertyDefinition(
        reader.ReadAttributeValue(XmlAttributeNames.FieldURI),
        reader.ReadAttributeValue(XmlAttributeNames.FieldIndex),
      );
      await reader.SkipCurrentElement();
      return true;
    case XmlElementNames.ExtendedFieldURI:
      propertyDefinitionOutParam.param = ExtendedPropertyDefinition();
      await (propertyDefinitionOutParam.param as ExtendedPropertyDefinition)
          .LoadFromXml(reader);
      return true;
    default:
      return false;
  }
}