public static async Task <TValue> ReadElementContentAsync <TValue>(this XmlReader reader, ValueConverter <TValue> valueConverter) { return(valueConverter.Convert(await reader.ReadElementContentAsStringAsync())); }
/// <summary> /// Gets a converted property value from the current snapshot of the /// current <see cref="Entity<TResource>"/>. /// </summary> /// <remarks> /// Use this method to create static properties from the dynamic properties /// exposed by the current snapshot. /// </remarks> /// <typeparam name="TValue"> /// Type of the value. /// </typeparam> /// <param name="name"> /// The name of a property. /// </param> /// <param name="valueConverter"> /// A value converter for converting property <paramref name="name"/>. /// </param> /// <returns> /// The converted value or /// <paramref name="valueConverter"/><c>.DefaultValue</c>, if /// <paramref name="name"/> does not exist. /// </returns> /// <exception cref="InvalidDataException"> /// The conversion failed. /// </exception> protected TValue GetValue <TValue>(string name, ValueConverter <TValue> valueConverter) { return(this.Snapshot.GetValue(name, valueConverter)); }