Exemple #1
0
 /// <summary>
 /// Gets an named argument (<c>name=value</c>) with the specified name.
 /// </summary>
 /// <param name="name">
 /// The name of argument that will be tested. Leading and trailing white spaces will be ignored. First letter will be normalized.
 /// </param>
 /// <exception cref="ArgumentNullException"><paramref name="name"/> is <c>null</c>.</exception>
 /// <returns>A matching <see cref="WikiImageLinkArgument"/> with the specified name, or <c>null</c> if no matching template is found.</returns>
 public WikiImageLinkArgument this[string name]
 {
     get
     {
         if (name == null)
         {
             throw new ArgumentNullException(nameof(name));
         }
         name = MwParserUtility.NormalizeImageLinkArgumentName(name);
         // We want to choose the last matching arguments, if there are multiple choices.
         return(EnumNameArgumentPairs(true).FirstOrDefault(p => p.Key == name).Value);
     }
 }
Exemple #2
0
 private IEnumerable <KeyValuePair <string, WikiImageLinkArgument> > EnumNameArgumentPairs(bool reverse)
 {
     return((reverse ? Reverse() : this).Select(arg =>
                                                new KeyValuePair <string, WikiImageLinkArgument>(MwParserUtility.NormalizeImageLinkArgumentName(arg.Name), arg)));
 }