/// <summary> /// Constructs a new instance of the <see cref="Type"/> and fills it by using the query string. /// </summary> /// <param name="queryfyDotNet">The <see cref="IQueryfyDotNet"/>.</param> /// <typeparam name="T">The <see cref="Type"/> of the destination.</typeparam> /// <param name="query">The query string.</param> /// <exception cref="ArgumentNullException">The value of '<paramref name="queryfyDotNet"/>' and '<paramref name="query"/>' cannot be null. </exception> public static T Parse <T>([NotNull] this IQueryfyDotNet queryfyDotNet, [NotNull] String query) { if (queryfyDotNet == null) { throw new ArgumentNullException(nameof(queryfyDotNet)); } if (String.IsNullOrEmpty(query)) { throw new ArgumentNullException(nameof(query)); } return((T)queryfyDotNet.Parse(typeof(T), query)); }
/// <summary> /// Constructs a new instance of the <see cref="Type"/> and fills it with the supplied mappings in the <see cref="IParserContext"/>. /// </summary> /// <param name="queryfyDotNet">The <see cref="IQueryfyDotNet"/>.</param> /// <typeparam name="T">The <see cref="Type"/> of the destination.</typeparam> /// <param name="parserContext">The <see cref="IParserContext"/>.</param> /// <exception cref="ArgumentNullException">The value of '<paramref name="queryfyDotNet"/>' and '<paramref name="parserContext"/>' cannot be null. </exception> public static T Parse <T>([NotNull] this IQueryfyDotNet queryfyDotNet, [NotNull] IParserContext parserContext) { if (queryfyDotNet == null) { throw new ArgumentNullException(nameof(queryfyDotNet)); } if (parserContext == null) { throw new ArgumentNullException(nameof(parserContext)); } return((T)queryfyDotNet.Parse(typeof(T), parserContext)); }