Merge pull request #498 from Unroll-Me/master
[mono.git] / mcs / class / Mono.Options / Documentation / en / Mono.Options / OptionSet.xml
1 <Type Name="OptionSet" FullName="Mono.Options.OptionSet">
2   <TypeSignature Language="C#" Value="public class OptionSet : System.Collections.ObjectModel.KeyedCollection&lt;string,Mono.Options.Option&gt;" />
3   <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit OptionSet extends System.Collections.ObjectModel.KeyedCollection`2&lt;string, class Mono.Options.Option&gt;" />
4   <AssemblyInfo>
5     <AssemblyName>Mono.Options</AssemblyName>
6     <AssemblyVersion>0.2.0.0</AssemblyVersion>
7     <AssemblyVersion>0.2.1.0</AssemblyVersion>
8     <AssemblyVersion>0.2.2.0</AssemblyVersion>
9     <AssemblyVersion>0.2.3.0</AssemblyVersion>
10   </AssemblyInfo>
11   <ThreadingSafetyStatement>
12     All public static members of this type are safe for multithreaded
13     operations.  The 
14     <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable&lt;System.String&gt;)" />
15     instance method is thread-safe if no concurrent modifying methods are
16     invoked 
17     (<see cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />,
18     <see cref="M:System.Collections.ObjectModel.Collection{Mono.Options.Option}.Remove(``0)" />,
19     etc.).
20   </ThreadingSafetyStatement>
21   <Base>
22     <BaseTypeName>System.Collections.ObjectModel.KeyedCollection&lt;System.String,Mono.Options.Option&gt;</BaseTypeName>
23     <BaseTypeArguments>
24       <BaseTypeArgument TypeParamName="!0">System.String</BaseTypeArgument>
25       <BaseTypeArgument TypeParamName="!1">Mono.Options.Option</BaseTypeArgument>
26     </BaseTypeArguments>
27   </Base>
28   <Interfaces />
29   <Docs>
30     <summary>
31       A class to parse program options.
32     </summary>
33     <remarks>
34       <para>
35         A common requirement for command-line programs is option parsing.  
36         The command line consists of a sequence of 
37         <paramref name="arguments" />.  
38         <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
39         parses this argument
40         sequence, invoking actions of registered 
41         <see cref="T:Mono.Options.Option" />s when a sequence of arguments 
42         matching the <see cref="T:Mono.Options.Option" />s requirements are
43         encountered.  <see cref="T:Mono.Options.Option" />'s are registered 
44         with <see cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />
45         and its overloads.
46       </para>
47       <para>
48         <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />,
49         returns a 
50         <see cref="T:System.Collections.Generic.List{System.String}" /> of all
51         arguments which were not matched by a registered
52         <see cref="T:Mono.Options.Option" />.
53       </para>
54       <para>
55         Response files, as used by <c>mcs</c> and other compiler tools, may be
56         supported by using <see cref="T:Mono.Options.ResponseFileSource" />.
57       </para>
58       <para>
59         "Headers" -- string constants which allow grouping of options in the
60         output of
61         <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions(System.IO.TextWriter)" />
62         -- may be provided "inline" with the actual options. The <c>greet</c>
63         example below shows such usage.
64       </para>
65       <para>
66         Three conditions must be met for a sequence of arguments to be
67         considered as a match for an <see cref="T:Mono.Options.Option" />:
68       </para>
69       <list type="bullet">
70         <item>
71           <term>
72           The <paramref name="name" /> must be matched.  An 
73           <see cref="T:Mono.Options.Option" /> has one or more names, as
74           returned from <see cref="M:Mono.Options.Option.GetNames" />.
75           Matched names must start with a <paramref name="flag" /> 
76           (even though the flag is not part of the
77           <see cref="P:Mono.Options.Option.Prototype" />): <c>-</c>, 
78           <c>--</c>, or <c>/</c>.
79           There are several different name matching algorithms:
80           <list type="bullet"><item><term><para><paramref name="Simple" /> names are matched when the argument
81                 consists solely of a flag followed by an option name.
82               </para><para>
83                 Examples: <c>-opt</c>, <c>--opt</c>, and <c>/opt</c> are all
84                 simple names for the <c>opt</c> option.
85               </para></term></item><item><term><para><paramref name="Boolean" /> names are matched when the
86                 argument consists of a flag, followed by an option name,
87                 followed by <c>+</c> or <c>-</c>.  If a <c>+</c> follows the
88                 name, the option is enabled, otherwise the option is disabled.
89               </para><para>
90                 Examples: <c>-opt+</c> and <c>-opt-</c> enable and disble the
91                 <c>opt</c> option.
92               </para></term></item><item><term><para><paramref name="Assigned" /> names are matched when the
93                 argument consists of a flag, followed by an option name,
94                 followed by a <c>=</c> or <c>:</c>, followed by an (optional)
95                 string.
96               </para><para>
97                 Examples: <c>-opt=A</c>, <c>--opt:B</c>, and <c>/opt=C</c> all
98                 provide a value for the <c>opt</c> option.
99               </para></term></item><item><term><para><paramref name="Bundled" /> names are matched only when
100                 simple, boolean, and assigned names are not matched,
101                 the flag is <c>-</c>, and the first character matches a
102                 registered option.  Any number of (single-character) boolean 
103                 options may be bundled in this fashion, and at most one
104                 <see cref="F:Mono.Options.OptionValueType.Optional" /> or
105                 <see cref="F:Mono.Options.OptionValueType.Required" /> option 
106                 (which will use all remaining characters within the argument
107                 as a value).
108               </para><para>
109                 Examples: <c>-xvfinput-file</c> could match the boolean 
110                 <see cref="T:Mono.Options.Option" />s <c>x</c> and <c>v</c>
111                 and the value-accepting option <c>f</c>, which will get the
112                 value <c>input-file</c>.  (Other interpretations are also
113                 possible, depending upon which options are registered.)
114               </para></term></item><item><term><para>
115                   As a fallback, a <paramref name="default handler" /> may be
116                   registered which will handle <paramref name="all" />
117                   arguments which are not handled by any of the above matching
118                   algorithms.  The default handler is designated by the name
119                   <c>&lt;&gt;</c> (which may be an alias for another named
120                   <see cref="T:Mono.Options.Option" />).
121                 </para><para>
122                   Default handlers are useful for argument runs -- sequences
123                   of arguments that are not related to each other but are
124                   instead related to a prior option on the command line, and it
125                   isn't desirable to use named options for these.  For
126                   example, <c>mdoc-assemble --format=ecma DirA DirB 
127                   --format=man FileC</c> would process <c>DirA</c> and
128                   <c>DirB</c> with <c>--format=ecma</c> in effect, and then
129                   process <c>FileC</c> with <c>--format=man</c> in effect.
130                 </para><para>
131                   See 
132                   <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
133                   for additional details regarding default option handlers.
134                 </para></term></item></list></term>
135         </item>
136         <item>
137           <term>
138           The <paramref name="type" /> must be matched.  
139           <see cref="P:Mono.Options.Option.OptionValueType" /> specifies the
140           option's type.  See below for more information.
141         </term>
142         </item>
143         <item>
144           <term>
145           The <paramref name="value count" /> must be matched.  Whether an
146           option takes any values is dependent upon the option's type
147           (previous bullet), but the number of values the option either
148           accepts or requires is specified by the
149           <see cref="P:Mono.Options.Option.MaxValueCount" /> property.
150         </term>
151         </item>
152       </list>
153       <para>
154         There are three types of <see cref="T:Mono.Options.Option" />s that
155         can be parsed:
156       </para>
157       <list type="number">
158         <item>
159           <term>
160           Boolean options, which correspond to a 
161           <see cref="P:Mono.Options.Option.OptionValueType" /> value of
162           <see cref="F:Mono.Options.OptionValueType.None" />.
163           When a matching argument is encountered, their registered
164           action is invoked immediately.  The <see cref="T:System.Action`1" />
165           value will be non-<see langword="default(T)" /> if the value is true,
166           e.g.  if <c>-option</c> or <c>-option+</c> is specified, and the value
167           will be <see langword="default(T)" /> if the value is false, e.g. 
168           if <c>-option-</c> is specified.
169         </term>
170         </item>
171         <item>
172           <term>
173             <para>
174             Optional value options, which correspond to a 
175             <see cref="P:Mono.Options.Option.OptionValueType" /> value of
176             <see cref="F:Mono.Options.OptionValueType.Optional" />.
177             Optional value options are not "greedy"; they will only get their
178             value only from the current argument.  If the value is not present, 
179             <see langword="default(T)" /> is provided to their corresponding
180             <see cref="T:System.Action`1" />.
181           </para>
182             <para>
183             Thus, <c>-opt:value</c> would pass <c>value</c> to the
184             action registered for <c>opt</c>, while <c>-opt value</c> would pass
185             <see langword="default(T)" /> to the action registered for 
186             <c>opt</c> and <c>value</c> would be an unparsed argument.
187           </para>
188           </term>
189         </item>
190         <item>
191           <term>
192             <para>
193             Required value options, which correspond to a 
194             <see cref="P:Mono.Options.Option.OptionValueType" /> value of
195             <see cref="F:Mono.Options.OptionValueType.Required" />.
196             Required value options are "greedy" -- if the value is not found
197             within the current argument, the following argument(s) will be used to
198             supply the value(s).  Once enough values have been parsed, 
199             their corresponding <see cref="T:System.Action`1" /> is invoked.
200           </para>
201             <para>
202             Thus, both <c>-opt:value</c> and <c>-opt value</c> would pass 
203             <c>value</c> to the action registered for <c>opt</c>.
204           </para>
205             <para>
206             If no value can be found, an 
207             <see cref="T:Mono.Options.OptionException" /> is thrown from
208             <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />.
209           </para>
210           </term>
211         </item>
212       </list>
213       <block subset="none" type="behaviors">
214         <para>
215           Use of <c>OptionSet</c> is split up into two parts:
216         </para>
217         <list type="number">
218           <item>
219             <term>Initialization.</term>
220           </item>
221           <item>
222             <term>Parsing.</term>
223           </item>
224         </list>
225         <para>
226           During the <paramref name="initialization" /> phase, new
227           <see cref="T:Mono.Options.Option" /> instances are created and
228           associated with an action to perform when the <c>Option</c>
229           requirements are met (e.g. when a required value has been
230           encountered).  This phase is not thread safe.
231           All options added during this phase are considered to have been
232           <paramref name="registered" />.
233         </para>
234         <code lang="C#">OptionSet p = new OptionSet () {
235   { "option-a", v =&gt; { /* action to perform */ } },
236 };</code>
237         <para>
238           There are three ways to add <see cref="T:Mono.Options.Option" />s
239           to the <see cref="T:Mono.Options.OptionSet" />:
240         </para>
241         <list type="number">
242           <item>
243             <term>
244             With C# collection initializers, as used above.
245           </term>
246           </item>
247           <item>
248             <term>
249             Explicitly by calling
250             <see cref="M:Mono.Options.OptionSet.Add(System.String,System.Action{System.String})" />
251             and the other <c>Add</c> overloads.
252           </term>
253           </item>
254           <item>
255             <term>
256             By creating a new subclass of <see cref="T:Mono.Options.Option" />
257             and adding it via 
258             <see cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />.
259             This is not recommended, but is available if you require more
260             direct option handling than the default 
261             <see cref="T:Mono.Options.Option" /> implementation provides.
262           </term>
263           </item>
264         </list>
265         <para>
266           During the <paramref name="parsing" /> phase, an
267           <see cref="T:System.Collections.Generic.IEnumerable{System.String}" />
268           is enumerated, looking for arguments which match a registered option,
269           and invoking the corresponding action when an option and associated
270           (optional) value is encountered.  During this phase, the 
271           <see cref="T:Mono.Options.OptionSet" /> instance itself is thread
272           safe, but full thread safety depends upon thread-safety of the
273           registered actions.  Any option-like strings for names that haven't
274           been registered, e.g. <c>--this-was-never-registered=false</c>, and
275           all arguments that are not used as option values are returned from 
276           <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
277           or processed by the default handler <c>&lt;&gt;</c>, if registered.
278         </para>
279         <code lang="C#">List&lt;string&gt; extra = p.Parse (new string[]{"-option-a"});</code>
280       </block>
281       <block subset="none" type="overrides">
282         <para>
283           Subclasses can override the following <see langword="virtual" /> 
284           methods to customize option parsing behavior:
285         </para>
286         <list type="bullet">
287           <item>
288             <term>
289               <see cref="M:Mono.Options.OptionSet.Parse(System.String,Mono.Options.OptionContext)" />
290             </term>
291           </item>
292           <item>
293             <term>
294               <see cref="M:Mono.Options.OptionSet.CreateOptionContext" />
295             </term>
296           </item>
297         </list>
298       </block>
299     </remarks>
300     <example>
301       <para>
302         The following <c>greet</c> example demonstrates some simple usage of
303         <see cref="T:Mono.Options.OptionSet" />.
304       </para>
305       <code lang="C#" src="examples/greet.cs">using System;
306 using System.Collections.Generic;
307 using Mono.Options;
308
309 class Test {
310         static int verbosity;
311
312         public static void Main (string[] args)
313         {
314                 bool show_help = false;
315                 List&lt;string&gt; names = new List&lt;string&gt; ();
316                 int repeat = 1;
317
318                 var p = new OptionSet () {
319                         "Usage: greet [OPTIONS]+ message",
320                         "Greet a list of individuals with an optional message.",
321                         "If no message is specified, a generic greeting is used.",
322                         "",
323                         "Options:",
324                         { "n|name=", "the {NAME} of someone to greet.",
325                           v =&gt; names.Add (v) },
326                         { "r|repeat=", 
327                                 "the number of {TIMES} to repeat the greeting.\n" + 
328                                         "this must be an integer.",
329                           (int v) =&gt; repeat = v },
330                         { "v", "increase debug message verbosity",
331                           v =&gt; { if (v != null) ++verbosity; } },
332                         { "h|help",  "show this message and exit", 
333                           v =&gt; show_help = v != null },
334                 };
335
336                 List&lt;string&gt; extra;
337                 try {
338                         extra = p.Parse (args);
339                 }
340                 catch (OptionException e) {
341                         Console.Write ("greet: ");
342                         Console.WriteLine (e.Message);
343                         Console.WriteLine ("Try `greet --help' for more information.");
344                         return;
345                 }
346
347                 if (show_help) {
348                         p.WriteOptionDescriptions (Console.Out);
349                         return;
350                 }
351
352                 string message;
353                 if (extra.Count &gt; 0) {
354                         message = string.Join (" ", extra.ToArray ());
355                         Debug ("Using new message: {0}", message);
356                 }
357                 else {
358                         message = "Hello {0}!";
359                         Debug ("Using default message: {0}", message);
360                 }
361
362                 foreach (string name in names) {
363                         for (int i = 0; i &lt; repeat; ++i)
364                                 Console.WriteLine (message, name);
365                 }
366         }
367
368         static void Debug (string format, params object[] args)
369         {
370                 if (verbosity &gt; 0) {
371                         Console.Write ("# ");
372                         Console.WriteLine (format, args);
373                 }
374         }
375 }
376
377 </code>
378       <para>The output (under the influence of different command-line
379         arguments) is:</para>
380       <code lang="sh" src="examples/greet.txt">$ mono greet.exe --help
381 Usage: greet [OPTIONS]+ message
382 Greet a list of individuals with an optional message.
383 If no message is specified, a generic greeting is used.
384
385 Options:
386   -n, --name=NAME            the NAME of someone to greet.
387   -r, --repeat=TIMES         the number of TIMES to repeat the greeting.
388                                this must be an integer.
389   -v                         increase debug message verbosity
390   -h, --help                 show this message and exit
391
392 $ mono greet.exe -v- -n A -name=B --name=C /name D -nE
393 Hello A!
394 Hello B!
395 Hello C!
396 Hello D!
397 Hello E!
398
399 $ mono greet.exe -v -n E custom greeting for: {0}
400 # Using new message: custom greeting for: {0}
401 custom greeting for: E
402
403 $ mono greet.exe -r 3 -n A
404 Hello A!
405 Hello A!
406 Hello A!
407
408 $ mono greet.exe -r not-an-int
409 greet: Could not convert string `not-an-int' to type Int32 for option `-r'.
410 Try `greet --help' for more information.
411 </code>
412       <para>
413         Notice how the output produced by <c>--help</c> uses the
414         descriptions provided during <c>OptionSet</c> initialization.
415         Notice that the <see cref="T:Mono.Options.Option" /> requiring a 
416         value (<c>n|name=</c>) can use multiple different forms of invocation,
417         including: 
418         <c>-n value</c>, 
419         <c>-n=value</c>, 
420         <c>-name value</c>, 
421         <c>-name=value</c>, 
422         <c>--name value</c>,
423         <c>--name=value</c>,
424         <c>/name value</c>, and
425         <c>/name=value</c>.
426       </para>
427       <para>
428         Notice also that the boolean <c>v</c> option can take three
429         separate forms: <c>-v</c> and <c>-v+</c>, which both enable the option,
430         and <c>-v-</c>, which disables the option.  (The second <c>greet</c>
431         invocation uses <c>-v-</c>, which is why no debug messages are shown.)
432       </para>
433       <para>
434         Finally, note that the action can specify a type to use.  If no type
435         is provided, the action parameter will be a 
436         <see cref="T:System.String" />.  If a type is provided, then
437         <see cref="T:System.ComponentModel.TypeConverter" /> will be used to
438         convert a string to the specified type.
439       </para>
440     </example>
441     <example>
442       <para>
443         The following example shows how options and values can be bundled
444         together.
445       </para>
446       <code lang="C#" src="examples/bundling.cs">using System;
447 using System.Linq;
448 using System.Collections.Generic;
449 using Mono.Options;
450
451 class Test {
452         public static void Main (string[] args)
453         {
454                 var show_help = false;
455                 var macros = new Dictionary&lt;string, string&gt;();
456                 bool create = false, extract = false, list = false;
457                 string output = null, input = null;
458                 string color  = null;
459
460                 var p = new OptionSet () {
461                         "Usage: bundling [OPTIONS]+",
462                         "Demo program to show the effects of bundling options and their values",
463                         "",
464                         "gcc-like options:",
465                         { "D:", "Predefine a macro with an (optional) value.",
466                                 (m, v) =&gt; {
467                                         if (m == null)
468                                                 throw new OptionException ("Missing macro name for option -D.", 
469                                                                 "-D");
470                                         macros.Add (m, v);
471                                 } },
472                         { "d={--&gt;}{=&gt;}", "Alternate macro syntax.", 
473                                 (m, v) =&gt; macros.Add (m, v) },
474                         { "o=", "Specify the output file", v =&gt; output = v },
475
476                         "",
477                         "tar-like options:",
478                         { "f=", "The input file",   v =&gt; input = v },
479                         { "x",  "Extract the file", v =&gt; extract = v != null },
480                         { "c",  "Create the file",  v =&gt; create = v != null },
481                         { "t",  "List the file",    v =&gt; list = v != null },
482
483                         "",
484                         "ls-like optional values:",
485                         { "color:", "control whether and when color is used", 
486                                 v =&gt; color = v },
487
488                         "",
489                         "other:",
490                         { "h|help",  "show this message and exit", 
491                           v =&gt; show_help = v != null },
492                         // default
493                         { "&lt;&gt;",
494                                 v =&gt; Console.WriteLine ("def handler: color={0}; arg={1}", color, v)},
495                 };
496
497                 try {
498                         p.Parse (args);
499                 }
500                 catch (OptionException e) {
501                         Console.Write ("bundling: ");
502                         Console.WriteLine (e.Message);
503                         Console.WriteLine ("Try `greet --help' for more information.");
504                         return;
505                 }
506
507                 if (show_help) {
508                         p.WriteOptionDescriptions (Console.Out);
509                         return;
510                 }
511
512                 Console.WriteLine ("Macros:");
513                 foreach (var m in (from k in macros.Keys orderby k select k)) {
514                         Console.WriteLine ("\t{0}={1}", m, macros [m] ?? "&lt;null&gt;");
515                 }
516                 Console.WriteLine ("Options:");
517                 Console.WriteLine ("\t Input File: {0}", input);
518                 Console.WriteLine ("\tOuptut File: {0}", output);
519                 Console.WriteLine ("\t     Create: {0}", create);
520                 Console.WriteLine ("\t    Extract: {0}", extract);
521                 Console.WriteLine ("\t       List: {0}", list);
522                 Console.WriteLine ("\t      Color: {0}", color ?? "&lt;null&gt;");
523         }
524 }
525
526 </code>
527       <para>
528         The output (under the influence of different command-line arguments) is:
529       </para>
530       <code lang="sh" src="examples/bundling.txt">$ mono bundling.exe --help
531 Usage: bundling [OPTIONS]+
532 Demo program to show the effects of bundling options and their values
533
534 gcc-like options:
535   -D[=VALUE1:VALUE2]         Predefine a macro with an (optional) value.
536   -d=VALUE1--&gt;VALUE2         Alternate macro syntax.
537   -o=VALUE                   Specify the output file
538
539 tar-like options:
540   -f=VALUE                   The input file
541   -x                         Extract the file
542   -c                         Create the file
543   -t                         List the file
544
545 ls-like optional values:
546       --color[=VALUE]        control whether and when color is used
547
548 other:
549   -h, --help                 show this message and exit
550
551 $ mono bundling.exe -D
552 bundling: Missing macro name for option -D.
553 Try `greet --help' for more information.
554
555 $ mono bundling.exe -DA -DB=C "-dD--&gt;E" "-dF=&gt;G" -d "H=&gt;I" -cf input --color -ooutput
556 Macros:
557         A=&lt;null&gt;
558         B=C
559         D=E
560         F=G
561         H=I
562 Options:
563          Input File: input
564         Ouptut File: output
565              Create: True
566             Extract: False
567                List: False
568               Color: &lt;null&gt;
569
570 $ mono bundling.exe -cfv input
571 def handler: color=; arg=input
572 Macros:
573 Options:
574          Input File: v
575         Ouptut File: 
576              Create: True
577             Extract: False
578                List: False
579               Color: &lt;null&gt;
580
581 $ mono bundling.exe -xctf input
582 Macros:
583 Options:
584          Input File: input
585         Ouptut File: 
586              Create: True
587             Extract: True
588                List: True
589               Color: &lt;null&gt;
590
591 $ mono bundling.exe --color=auto -o output -finput
592 Macros:
593 Options:
594          Input File: input
595         Ouptut File: output
596              Create: False
597             Extract: False
598                List: False
599               Color: auto
600
601 $ mono bundling.exe --color=on A B --color=off C D
602 def handler: color=on; arg=A
603 def handler: color=on; arg=B
604 def handler: color=off; arg=C
605 def handler: color=off; arg=D
606 Macros:
607 Options:
608          Input File: 
609         Ouptut File: 
610              Create: False
611             Extract: False
612                List: False
613               Color: off
614 </code>
615     </example>
616     <example>
617       <para>
618         The following example shows a custom <c>OptionSet</c> subclass with
619         the following additional functionality:
620       </para>
621       <list type="number">
622         <item>
623           <term>
624           Option name lookup is done in a case insensitive fashion, so
625           <c>--name</c> and <c>--NAME</c> are identical.
626         </term>
627         </item>
628         <item>
629           <term>
630           Option-like strings cannot be used as values to options, so
631           <c>--name --repeat</c> is an error.
632         </term>
633         </item>
634         <item>
635           <term>
636           A key/value parser is provided, to show the use of custom 
637           <see cref="T:Mono.Options.OptionContext" /> and
638           <see cref="T:Mono.Options.Option" /> subclasses.
639         </term>
640         </item>
641       </list>
642       <code lang="C#" src="examples/subclass.cs">// Case-Insensitive and Concatenating OptionSet
643 using System;
644 using System.Collections.Generic;
645 using Mono.Options;
646
647 class DemoOptionSet : OptionSet {
648         protected override void InsertItem (int index, Option item)
649         {
650                 if (item.Prototype.ToLower () != item.Prototype)
651                         throw new ArgumentException ("prototypes must be lower-case!");
652                 base.InsertItem (index, item);
653         }
654
655         protected override OptionContext CreateOptionContext ()
656         {
657                 return new OptionContext (this);
658         }
659
660         protected override bool Parse (string option, OptionContext c)
661         {
662                 string f, n, s, v;
663                 bool haveParts = GetOptionParts (option, out f, out n, out s, out v);
664                 Option nextOption = null;
665                 string newOption  = option;
666
667                 if (haveParts) {
668                         string nl = n.ToLower ();
669                         nextOption = Contains (nl) ? this [nl] : null;
670                         newOption = f + n.ToLower () + (v != null ? s + v : "");
671                 }
672
673                 if (c.Option != null) {
674                         // Prevent --a --b
675                         if (c.Option != null &amp;&amp; haveParts) {
676                                 if (nextOption == null) {
677                                         // ignore
678                                 }
679                                 else 
680                                         throw new OptionException (
681                                                 string.Format ("Found option `{0}' as value for option `{1}'.",
682                                                         option, c.OptionName), c.OptionName);
683                         }
684
685                         // have a option w/ required value; try to concat values.
686                         if (AppendValue (option, c)) {
687                                 if (!option.EndsWith ("\\") &amp;&amp; 
688                                                 c.Option.MaxValueCount == c.OptionValues.Count) {
689                                         c.Option.Invoke (c);
690                                 }
691                                 return true;
692                         }
693                         else
694                                 base.Parse (newOption, c);
695                 }
696
697                 if (!haveParts || v == null) {
698                         // Not an option; let base handle as a non-option argument.
699                         return base.Parse (newOption, c);
700                 }
701
702                 if (nextOption.OptionValueType != OptionValueType.None &amp;&amp; 
703                                 v.EndsWith ("\\")) {
704                         c.Option = nextOption;
705                         c.OptionValues.Add (v);
706                         c.OptionName = f + n;
707                         return true;
708                 }
709
710                 return base.Parse (newOption, c);
711         }
712
713         private bool AppendValue (string value, OptionContext c)
714         {
715                 bool added = false;
716                 string[] seps = c.Option.GetValueSeparators ();
717                 foreach (var o in seps.Length != 0
718                                 ? value.Split (seps, StringSplitOptions.None)
719                                 : new string[]{value}) {
720                         int idx = c.OptionValues.Count-1;
721                         if (idx == -1 || !c.OptionValues [idx].EndsWith ("\\")) {
722                                 c.OptionValues.Add (o);
723                                 added = true;
724                         }
725                         else {
726                                 c.OptionValues [idx] += value;
727                                 added = true;
728                         }
729                 }
730                 return added;
731         }
732 }
733
734 class Demo {
735         public static void Main (string[] args)
736         {
737                 List&lt;string&gt; names = new List&lt;string&gt; ();
738                 Dictionary&lt;string,string&gt; map = new Dictionary&lt;string,string&gt; ();
739                 int repeat = 1;
740
741                 OptionSet p = new DemoOptionSet () {
742                         { "n|name=",    v =&gt; names.Add (v) },
743                         { "r|repeat:",  (int v) =&gt; repeat = v },
744                         { "m|map=",     (k,v) =&gt; map.Add (k, v) },
745                 };
746
747                 List&lt;string&gt; extra;
748                 try {
749                         extra = p.Parse (args);
750                 }
751                 catch (OptionException e) {
752                         Console.Write ("subclass: ");
753                         Console.WriteLine (e.Message);
754                         return;
755                 }
756
757                 string message;
758                 if (extra.Count &gt; 0) {
759                         message = string.Join (" ", extra.ToArray ());
760                 }
761                 else {
762                         message = "Hello {0}!";
763                 }
764
765                 foreach (string name in names) {
766                         for (int i = 0; i &lt; repeat; ++i)
767                                 Console.WriteLine (message, name);
768                 }
769                 List&lt;string&gt; keys = new List&lt;string&gt;(map.Keys);
770                 keys.Sort ();
771                 foreach (string key in keys) {
772                         Console.WriteLine ("Key: {0}={1}", key, map [key]);
773                 }
774         }
775 }
776
777 </code>
778       <para>The output (under the influence of different command-line
779         arguments) is:
780       </para>
781       <code lang="sh" src="examples/subclass.txt">$ mono subclass.exe -n A -Name=B --NAME=C /nAMe D
782 Hello A!
783 Hello B!
784 Hello C!
785 Hello D!
786
787 $ mono subclass.exe --Repeat -name A
788
789 $ mono subclass.exe -Name --Repeat 3
790 subclass: Found option `--Repeat' as value for option `-name'.
791
792 $ mono subclass.exe --Map a b -mAp c=d /maP=e=f
793 Key: a=b
794 Key: c=d
795 Key: e=f
796
797 $ mono subclass.exe --map 'a\' 'b\' c 'd\' 'e\' f
798 Key: a\b\c=d\e\f
799 </code>
800       <para>Notice:</para>
801       <list type="bullet">
802         <item>
803           <term>
804           That <c>--name</c> is treated in a case-insensitive fashion.
805         </term>
806         </item>
807         <item>
808           <term>
809           That <c>repeat</c> has an optional value, so with 
810           <c>--Repeat -name A</c> the default <c>int</c> value is passed (0),
811           so no message is printed.
812         </term>
813         </item>
814         <item>
815           <term>
816           That <c>name</c> has a required value, so 
817           <c>-Name --Repeat 3</c> generates an error.
818         </term>
819         </item>
820         <item>
821           <term>
822           The <c>DemoOptionSet.Add()</c> method provides appropriate key/value
823           option pairs to the callback method.
824         </term>
825         </item>
826       </list>
827     </example>
828     <altmember cref="T:Mono.Options.ResponseFileSource" />
829   </Docs>
830   <Members>
831     <Member MemberName=".ctor">
832       <MemberSignature Language="C#" Value="public OptionSet ();" />
833       <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
834       <MemberType>Constructor</MemberType>
835       <AssemblyInfo>
836         <AssemblyVersion>0.2.0.0</AssemblyVersion>
837         <AssemblyVersion>0.2.1.0</AssemblyVersion>
838         <AssemblyVersion>0.2.2.0</AssemblyVersion>
839         <AssemblyVersion>0.2.3.0</AssemblyVersion>
840       </AssemblyInfo>
841       <Parameters />
842       <Docs>
843         <summary>
844           Creates and initializes a new 
845           <see cref="T:Mono.Options.OptionSet" /> class instance.
846         </summary>
847         <remarks>
848           <para>
849             This constructor causes the created 
850             <see cref="T:Mono.Options.OptionSet" /> instance to perform no
851             translation of string messages; consequently, no localization is
852             performed.
853           </para>
854         </remarks>
855         <altmember cref="C:Mono.Options.OptionSet(System.Converter{System.String,System.String})" />
856       </Docs>
857     </Member>
858     <Member MemberName=".ctor">
859       <MemberSignature Language="C#" Value="public OptionSet (Converter&lt;string,string&gt; localizer);" />
860       <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Converter`2&lt;string, string&gt; localizer) cil managed" />
861       <MemberType>Constructor</MemberType>
862       <AssemblyInfo>
863         <AssemblyVersion>0.2.0.0</AssemblyVersion>
864         <AssemblyVersion>0.2.1.0</AssemblyVersion>
865         <AssemblyVersion>0.2.2.0</AssemblyVersion>
866         <AssemblyVersion>0.2.3.0</AssemblyVersion>
867       </AssemblyInfo>
868       <Parameters>
869         <Parameter Name="localizer" Type="System.Converter&lt;System.String,System.String&gt;" />
870       </Parameters>
871       <Docs>
872         <param name="localizer">
873           A <see cref="T:System.Converter{System.String,System.String}" />
874           instance that will be used to translate strings.
875         </param>
876         <summary>
877           Creates and initializes a new 
878           <see cref="T:Mono.Options.OptionSet" /> class instance.
879         </summary>
880         <remarks>
881           <para>
882             This constructor initializes the 
883             <see cref="P:Mono.Options.OptionSet.MessageLocalizer" /> property
884             of the new instance using <paramref name="localizer" />.
885           </para>
886           <para>
887             Use this constructor when you want to perform some form of
888             localization or internationalization on text strings generated
889             from the <see cref="T:Mono.Options.OptionSet" /> class.
890             Generated strings include:
891           </para>
892           <list type="bullet">
893             <item>
894               <term>
895               The <see cref="P:Mono.Options.Option.Description" /> written by
896               <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions(System.IO.TextWriter)" />,
897               but not the option names themselves.
898             </term>
899             </item>
900             <item>
901               <term>
902               Message format strings used when an error is encountered.
903             </term>
904             </item>
905           </list>
906         </remarks>
907         <example>
908           <para>
909             See the following example, which demonstrates how different
910             localizers alter the program output.
911           </para>
912           <code lang="C#" src="examples/localization.cs">// Localization with NDesk.Options.OptionSet.
913 //
914 // Compile as:
915 //   gmcs -r:Mono.Posix.dll -r:NDesk.Options.dll code-localization.cs
916 using System;
917 using System.IO;
918 using Mono.Options;
919 using Mono.Unix;
920
921 class LocalizationDemo {
922         public static void Main (string[] args)
923         {
924                 bool with_gettext = false;
925                 string useLocalizer = null;
926                 var p = new OptionSet () {
927                         { "with-gettext", v =&gt; { useLocalizer = "gettext"; } },
928                         { "with-hello",   v =&gt; { useLocalizer = "hello"; } },
929                         { "with-default", v =&gt; { /* do nothing */ } },
930                 };
931                 p.Parse (args);
932
933                 Converter&lt;string, string&gt; localizer = f =&gt; f;
934                 switch (useLocalizer) {
935                         case "gettext":
936                                 Catalog.Init ("localization", 
937                                                 Path.Combine (AppDomain.CurrentDomain.BaseDirectory,
938                                                         "locale"));
939                                 localizer = f =&gt; { return Catalog.GetString (f); };
940                                 break;
941                         case "hello":
942                                 localizer = f =&gt; { return "hello:" + f; };;
943                                 break;
944                 }
945
946                 bool help = false;
947                 int verbose = 0;
948                 bool version = false;
949                 p = new OptionSet (localizer) {
950                         { "h|?|help", "show this message and exit.", 
951                                 v =&gt; help = v != null },
952                         { "v|verbose", "increase message verbosity.",
953                                 v =&gt; { ++verbose; } },
954                         { "n=", "must be an int",
955                                 (int n) =&gt; { /* ignore */ } },
956                         { "V|version", "output version information and exit.",
957                                 v =&gt; version = v != null },
958                 };
959                 try {
960                         p.Parse (args);
961                 }
962                 catch (OptionException e) {
963                         Console.Write ("localization: ");
964                         Console.WriteLine (e.Message);
965                         return;
966                 }
967                 if (help)
968                         p.WriteOptionDescriptions (Console.Out);
969                 if (version)
970                         Console.WriteLine ("NDesk.Options Localizer Demo 1.0");
971                 if (verbose &gt; 0)
972                         Console.WriteLine ("Message level: {0}", verbose);
973         }
974 }
975 </code>
976           <para>The output (under the influence of different command-line
977             arguments) is:</para>
978           <code lang="sh" src="examples/localization.txt">$ mono localization.exe --help --version
979   -h, -?, --help             show this message and exit.
980   -v, --verbose              increase message verbosity.
981   -n=VALUE                   must be an int
982   -V, --version              output version information and exit.
983 NDesk.Options Localizer Demo 1.0
984
985 $ LANGUAGE=es mono localization.exe --with-gettext --help --version
986   -h, -?, --help             A mostrar este mensaje y salir.
987   -v, --verbose              Aumento mensaje verbosidad.
988   -n=VALUE                   Debe ser un int
989   -V, --version              Salida de información de versión y sale.
990 NDesk.Options Localizer Demo 1.0
991
992 $ mono localization.exe --with-hello --help --version
993   -h, -?, --help             hello:show this message and exit.
994   -v, --verbose              hello:increase message verbosity.
995   -nhello:=VALUE             hello:must be an int
996   -V, --version              hello:output version information and exit.
997 NDesk.Options Localizer Demo 1.0
998
999 $ mono localization.exe -n not-an-int
1000 localization: Could not convert string `not-an-int' to type Int32 for option `-n'.
1001
1002 $ mono localization.exe --with-hello -n not-an-int
1003 localization: hello:Could not convert string `not-an-int' to type Int32 for option `-n'.
1004 </code>
1005           <para>Notice:</para>
1006           <list type="bullet">
1007             <item>
1008               <term>
1009               The <c>--with-gettext</c> parser uses 
1010               <see cref="M:Mono.Unix.Catalog.GetString" /> to translate all
1011               messages
1012             </term>
1013             </item>
1014             <item>
1015               <term>
1016               The <c>-with-hello</c> parser prefixes all 
1017               descriptions with <c>hello:</c>.
1018             </term>
1019             </item>
1020             <item>
1021               <term>
1022               Only the descriptions are translated, and not the command-line 
1023               arguments themselves.  Only error messages and 
1024               option descriptions are translated, not the options themselves.
1025             </term>
1026             </item>
1027           </list>
1028         </example>
1029       </Docs>
1030     </Member>
1031     <Member MemberName="Add">
1032       <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add (Mono.Options.ArgumentSource source);" />
1033       <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add(class Mono.Options.ArgumentSource source) cil managed" />
1034       <MemberType>Method</MemberType>
1035       <AssemblyInfo>
1036         <AssemblyVersion>0.2.2.0</AssemblyVersion>
1037         <AssemblyVersion>0.2.3.0</AssemblyVersion>
1038       </AssemblyInfo>
1039       <ReturnValue>
1040         <ReturnType>Mono.Options.OptionSet</ReturnType>
1041       </ReturnValue>
1042       <Parameters>
1043         <Parameter Name="source" Type="Mono.Options.ArgumentSource" />
1044       </Parameters>
1045       <Docs>
1046         <param name="source">
1047           A <see cref="T:Mono.Options.ArgumentSource" /> to register for
1048           argument processing.
1049         </param>
1050         <summary>
1051           Registers <paramref name="source" /> so that it may be consulted
1052           during argument processing within
1053           <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />.
1054         </summary>
1055         <returns>
1056           The current <see cref="T:Mono.Options.OptionSet" /> instance.
1057           This is to permit method chaining.
1058         </returns>
1059         <remarks>
1060         </remarks>
1061         <exception cref="T:System.ArgumentNullException">
1062           <paramref name="option" /> is <see langword="null" />.
1063         </exception>
1064       </Docs>
1065     </Member>
1066     <Member MemberName="Add">
1067       <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add (Mono.Options.Option option);" />
1068       <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add(class Mono.Options.Option option) cil managed" />
1069       <MemberType>Method</MemberType>
1070       <AssemblyInfo>
1071         <AssemblyVersion>0.2.0.0</AssemblyVersion>
1072         <AssemblyVersion>0.2.1.0</AssemblyVersion>
1073         <AssemblyVersion>0.2.2.0</AssemblyVersion>
1074         <AssemblyVersion>0.2.3.0</AssemblyVersion>
1075       </AssemblyInfo>
1076       <ReturnValue>
1077         <ReturnType>Mono.Options.OptionSet</ReturnType>
1078       </ReturnValue>
1079       <Parameters>
1080         <Parameter Name="option" Type="Mono.Options.Option" />
1081       </Parameters>
1082       <Docs>
1083         <param name="option">
1084           The <see cref="T:Mono.Options.Option" /> to register.
1085         </param>
1086         <summary>
1087           Registers <paramref name="option" /> so that any options matching
1088           <see cref="M:Mono.Options.Option.GetNames" /> will be treated
1089           specially by 
1090           <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />.
1091         </summary>
1092         <returns>
1093           The current <see cref="T:Mono.Options.OptionSet" /> instance.
1094           This is to permit method chaining.
1095         </returns>
1096         <remarks>
1097           Registers each option name returned by 
1098           <see cref="M:Mono.Options.Option.GetNames" />, ensuring that any
1099           option with a matching name will be handled by the 
1100           <paramref name="option" /> instance.
1101         </remarks>
1102         <exception cref="T:System.ArgumentException">
1103           <paramref name="option" /> has an alias (as returned from
1104           <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
1105           a previously registered <see cref="T:Mono.Options.Option" />.
1106         </exception>
1107         <exception cref="T:System.ArgumentNullException">
1108           <paramref name="option" /> is <see langword="null" />.
1109         </exception>
1110       </Docs>
1111     </Member>
1112     <Member MemberName="Add">
1113       <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add (string header);" />
1114       <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add(string header) cil managed" />
1115       <MemberType>Method</MemberType>
1116       <AssemblyInfo>
1117         <AssemblyVersion>0.2.3.0</AssemblyVersion>
1118       </AssemblyInfo>
1119       <ReturnValue>
1120         <ReturnType>Mono.Options.OptionSet</ReturnType>
1121       </ReturnValue>
1122       <Parameters>
1123         <Parameter Name="header" Type="System.String" />
1124       </Parameters>
1125       <Docs>
1126         <param name="header">
1127           A <see cref="T:System.String" /> containing the header to display
1128           during <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions(System.IO.TextWriter)" />.
1129         </param>
1130         <summary>
1131           Declare a header to be printed during
1132           <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions(System.IO.TextWriter)" />.
1133         </summary>
1134         <returns>
1135           The current <see cref="T:Mono.Options.OptionSet" /> instance.
1136           This is to permit method chaining.
1137         </returns>
1138         <remarks>
1139           <para>
1140             The <c>Add(string)</c> method can be used to provide option groupin
1141             in the output generatedy by
1142             <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions(System.IO.TextWriter)" />.
1143           </para>
1144         </remarks>
1145       </Docs>
1146     </Member>
1147     <Member MemberName="Add">
1148       <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add (string prototype, Mono.Options.OptionAction&lt;string,string&gt; action);" />
1149       <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add(string prototype, class Mono.Options.OptionAction`2&lt;string, string&gt; action) cil managed" />
1150       <MemberType>Method</MemberType>
1151       <AssemblyInfo>
1152         <AssemblyVersion>0.2.0.0</AssemblyVersion>
1153         <AssemblyVersion>0.2.1.0</AssemblyVersion>
1154         <AssemblyVersion>0.2.2.0</AssemblyVersion>
1155         <AssemblyVersion>0.2.3.0</AssemblyVersion>
1156       </AssemblyInfo>
1157       <ReturnValue>
1158         <ReturnType>Mono.Options.OptionSet</ReturnType>
1159       </ReturnValue>
1160       <Parameters>
1161         <Parameter Name="prototype" Type="System.String" />
1162         <Parameter Name="action" Type="Mono.Options.OptionAction&lt;System.String,System.String&gt;" />
1163       </Parameters>
1164       <Docs>
1165         <param name="prototype">
1166           A <see cref="T:System.String" /> containing all option aliases to
1167           register, an (optional) type specifier, and an (optional) value
1168           separator list; see 
1169           <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
1170           for details.
1171         </param>
1172         <param name="action">
1173           A <see cref="T:Mono.Options.OptionAction{System.String,System.String}" />
1174           to invoke when an option is parsed.
1175         </param>
1176         <summary>
1177           Registers each alias within <paramref name="prototype" /> so that any 
1178           options matching the aliases in <paramref name="prototype" /> will be
1179           handled by <paramref name="action" /> during any subsequent
1180           <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
1181           calls.
1182         </summary>
1183         <returns>
1184           The current <see cref="T:Mono.Options.OptionSet" /> instance.
1185           This is to permit method chaining.
1186         </returns>
1187         <remarks>
1188           Calls 
1189           <see cref="M:Mono.Options.OptionSet.Add(System.String,System.String,Mono.Options.OptionAction{System.String,System.String})" />
1190           with a <paramref name="description" /> value of 
1191           <see langword="null" />.
1192         </remarks>
1193         <altmember cref="M:Mono.Options.OptionSet.Add(System.String,System.String,Mono.Options.OptionAction{System.String,System.String})" />
1194         <altmember cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />
1195         <exception cref="T:System.ArgumentException">
1196           <paramref name="prototype" /> has an alias (as returned from
1197           <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
1198           a previously registered <see cref="T:Mono.Options.Option" />.
1199         </exception>
1200         <exception cref="T:System.ArgumentNullException">
1201           <para>
1202             <paramref name="prototype" /> is <see langword="null" /></para>
1203           <para>-or-</para>
1204           <para>
1205             <paramref name="action" /> is <see langword="null" /></para>
1206         </exception>
1207       </Docs>
1208     </Member>
1209     <Member MemberName="Add">
1210       <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add (string prototype, Action&lt;string&gt; action);" />
1211       <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add(string prototype, class System.Action`1&lt;string&gt; action) cil managed" />
1212       <MemberType>Method</MemberType>
1213       <AssemblyInfo>
1214         <AssemblyVersion>0.2.0.0</AssemblyVersion>
1215         <AssemblyVersion>0.2.1.0</AssemblyVersion>
1216         <AssemblyVersion>0.2.2.0</AssemblyVersion>
1217         <AssemblyVersion>0.2.3.0</AssemblyVersion>
1218       </AssemblyInfo>
1219       <ReturnValue>
1220         <ReturnType>Mono.Options.OptionSet</ReturnType>
1221       </ReturnValue>
1222       <Parameters>
1223         <Parameter Name="prototype" Type="System.String" />
1224         <Parameter Name="action" Type="System.Action&lt;System.String&gt;" />
1225       </Parameters>
1226       <Docs>
1227         <param name="prototype">
1228           A <see cref="T:System.String" /> containing all option aliases to
1229           register, an (optional) type specifier, and an (optional) value
1230           separator list; see 
1231           <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
1232           for details.
1233         </param>
1234         <param name="action">
1235           A <see cref="T:System.Action{System.String}" />
1236           to invoke when an option is parsed.
1237         </param>
1238         <summary>
1239           Registers each alias within <paramref name="prototype" /> so that any 
1240           options matching the aliases in <paramref name="prototype" /> will be
1241           handled by <paramref name="action" /> during any subsequent
1242           <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
1243           calls.
1244         </summary>
1245         <returns>
1246           The current <see cref="T:Mono.Options.OptionSet" /> instance.
1247           This is to permit method chaining.
1248         </returns>
1249         <remarks>
1250           Calls 
1251           <see cref="M:Mono.Options.OptionSet.Add(System.String,System.String,System.Action{System.String})" />
1252           with a <paramref name="description" /> value of 
1253           <see langword="null" />.
1254         </remarks>
1255         <altmember cref="M:Mono.Options.OptionSet.Add(System.String,System.String,System.Action{System.String})" />
1256         <altmember cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />
1257         <exception cref="T:System.ArgumentException">
1258           <paramref name="prototype" /> has an alias (as returned from
1259           <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
1260           a previously registered <see cref="T:Mono.Options.Option" />.
1261         </exception>
1262         <exception cref="T:System.ArgumentNullException">
1263           <para>
1264             <paramref name="prototype" /> is <see langword="null" /></para>
1265           <para>-or-</para>
1266           <para>
1267             <paramref name="action" /> is <see langword="null" /></para>
1268         </exception>
1269       </Docs>
1270     </Member>
1271     <Member MemberName="Add">
1272       <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add (string prototype, string description, Mono.Options.OptionAction&lt;string,string&gt; action);" />
1273       <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add(string prototype, string description, class Mono.Options.OptionAction`2&lt;string, string&gt; action) cil managed" />
1274       <MemberType>Method</MemberType>
1275       <AssemblyInfo>
1276         <AssemblyVersion>0.2.0.0</AssemblyVersion>
1277         <AssemblyVersion>0.2.1.0</AssemblyVersion>
1278         <AssemblyVersion>0.2.2.0</AssemblyVersion>
1279         <AssemblyVersion>0.2.3.0</AssemblyVersion>
1280       </AssemblyInfo>
1281       <ReturnValue>
1282         <ReturnType>Mono.Options.OptionSet</ReturnType>
1283       </ReturnValue>
1284       <Parameters>
1285         <Parameter Name="prototype" Type="System.String" />
1286         <Parameter Name="description" Type="System.String" />
1287         <Parameter Name="action" Type="Mono.Options.OptionAction&lt;System.String,System.String&gt;" />
1288       </Parameters>
1289       <Docs>
1290         <param name="prototype">
1291           A <see cref="T:System.String" /> containing all option aliases to
1292           register, an (optional) type specifier, and an (optional) value
1293           separator list; see 
1294           <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
1295           for details.
1296         </param>
1297         <param name="description">
1298           A <see cref="T:System.String" /> to be used to initialize
1299           the <see cref="P:Mono.Options.Option.Description" /> property.
1300         </param>
1301         <param name="action">
1302           A <see cref="T:Mono.Options.OptionAction{System.String,System.String}" />
1303           to invoke when an option is parsed.
1304         </param>
1305         <summary>
1306           Registers each alias within <paramref name="prototype" /> so that any 
1307           options matching the aliases in <paramref name="prototype" /> will be
1308           handled by <paramref name="action" /> during any subsequent
1309           <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
1310           calls.
1311         </summary>
1312         <returns>
1313           The current <see cref="T:Mono.Options.OptionSet" /> instance.
1314           This is to permit method chaining.
1315         </returns>
1316         <remarks>
1317           <para>
1318             Use this method when <paramref name="prototype" /> should accept
1319             two values, generally a key and a value.
1320           </para>
1321           <block subset="none" type="note">
1322             If <paramref name="prototype" /> specifies a 
1323             <see cref="F:Mono.Options.OptionValueType.Optional" /> option,
1324             then it's possible that both the key and the value will be
1325             <see langword="null" /> in the callback function.
1326           </block>
1327         </remarks>
1328         <altmember cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />
1329         <exception cref="T:System.ArgumentException">
1330           <paramref name="prototype" /> has an alias (as returned from
1331           <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
1332           a previously registered <see cref="T:Mono.Options.Option" />.
1333         </exception>
1334         <exception cref="T:System.ArgumentNullException">
1335           <para>
1336             <paramref name="prototype" /> is <see langword="null" /></para>
1337           <para>-or-</para>
1338           <para>
1339             <paramref name="action" /> is <see langword="null" /></para>
1340         </exception>
1341       </Docs>
1342     </Member>
1343     <Member MemberName="Add">
1344       <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add (string prototype, string description, Action&lt;string&gt; action);" />
1345       <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add(string prototype, string description, class System.Action`1&lt;string&gt; action) cil managed" />
1346       <MemberType>Method</MemberType>
1347       <AssemblyInfo>
1348         <AssemblyVersion>0.2.0.0</AssemblyVersion>
1349         <AssemblyVersion>0.2.1.0</AssemblyVersion>
1350         <AssemblyVersion>0.2.2.0</AssemblyVersion>
1351         <AssemblyVersion>0.2.3.0</AssemblyVersion>
1352       </AssemblyInfo>
1353       <ReturnValue>
1354         <ReturnType>Mono.Options.OptionSet</ReturnType>
1355       </ReturnValue>
1356       <Parameters>
1357         <Parameter Name="prototype" Type="System.String" />
1358         <Parameter Name="description" Type="System.String" />
1359         <Parameter Name="action" Type="System.Action&lt;System.String&gt;" />
1360       </Parameters>
1361       <Docs>
1362         <param name="prototype">
1363           A <see cref="T:System.String" /> containing all option aliases to
1364           register, an (optional) type specifier, and an (optional) value
1365           separator list; see 
1366           <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
1367           for details.
1368         </param>
1369         <param name="description">
1370           A <see cref="T:System.String" /> containing to used to initialize
1371           the <see cref="P:Mono.Options.Option.Description" /> property.
1372         </param>
1373         <param name="action">
1374           A <see cref="T:System.Action{System.String}" />
1375           to invoke when an option is parsed.
1376         </param>
1377         <summary>
1378           Registers each alias within <paramref name="prototype" /> so that any 
1379           options matching the aliases in <paramref name="prototype" /> will be
1380           handled by <paramref name="action" /> during any subsequent
1381           <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
1382           calls.
1383         </summary>
1384         <returns>
1385           The current <see cref="T:Mono.Options.OptionSet" /> instance.
1386           This is to permit method chaining.
1387         </returns>
1388         <remarks>
1389         </remarks>
1390         <altmember cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />
1391         <exception cref="T:System.ArgumentException">
1392           <paramref name="option" /> has an alias (as returned from
1393           <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
1394           a previously registered <see cref="T:Mono.Options.Option" />.
1395         </exception>
1396         <exception cref="T:System.ArgumentNullException">
1397           <para>
1398             <paramref name="prototype" /> is <see langword="null" /></para>
1399           <para>-or-</para>
1400           <para>
1401             <paramref name="action" /> is <see langword="null" /></para>
1402         </exception>
1403       </Docs>
1404     </Member>
1405     <Member MemberName="Add">
1406       <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add (string prototype, string description, Mono.Options.OptionAction&lt;string,string&gt; action, bool hidden);" />
1407       <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add(string prototype, string description, class Mono.Options.OptionAction`2&lt;string, string&gt; action, bool hidden) cil managed" />
1408       <MemberType>Method</MemberType>
1409       <AssemblyInfo>
1410         <AssemblyVersion>0.2.3.0</AssemblyVersion>
1411       </AssemblyInfo>
1412       <ReturnValue>
1413         <ReturnType>Mono.Options.OptionSet</ReturnType>
1414       </ReturnValue>
1415       <Parameters>
1416         <Parameter Name="prototype" Type="System.String" />
1417         <Parameter Name="description" Type="System.String" />
1418         <Parameter Name="action" Type="Mono.Options.OptionAction&lt;System.String,System.String&gt;" />
1419         <Parameter Name="hidden" Type="System.Boolean" />
1420       </Parameters>
1421       <Docs>
1422         <param name="prototype">
1423           A <see cref="T:System.String" /> containing all option aliases to
1424           register, an (optional) type specifier, and an (optional) value
1425           separator list; see
1426           <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
1427           for details.
1428         </param>
1429         <param name="description">
1430           A <see cref="T:System.String" /> containing to used to initialize
1431           the <see cref="P:Mono.Options.Option.Description" /> property.
1432         </param>
1433         <param name="action">
1434           A <see cref="T:Mono.Options.OptionAction{System.String,System.String}" />
1435           to invoke when an option is parsed.
1436         </param>
1437         <param name="hidden">
1438           A <see cref="T:System.Boolean" /> specifying whether or not the
1439           Option should be displayed in
1440           <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions" />.
1441         </param>
1442         <summary>
1443           Registers each alias within <paramref name="prototype" /> so that any
1444           options matching the aliases in <paramref name="prototype" /> will be
1445           handled by <paramref name="action" /> during any subsequent
1446           <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
1447           calls.
1448         </summary>
1449         <returns>
1450           The current <see cref="T:Mono.Options.OptionSet" /> instance.
1451           This is to permit method chaining.
1452         </returns>
1453         <remarks>
1454         </remarks>
1455         <altmember cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />
1456         <exception cref="T:System.ArgumentException">
1457           <paramref name="option" /> has an alias (as returned from
1458           <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
1459           a previously registered <see cref="T:Mono.Options.Option" />.
1460         </exception>
1461         <exception cref="T:System.ArgumentNullException">
1462           <para>
1463             <paramref name="prototype" /> is <see langword="null" /></para>
1464           <para>-or-</para>
1465           <para>
1466             <paramref name="action" /> is <see langword="null" /></para>
1467         </exception>
1468       </Docs>
1469     </Member>
1470     <Member MemberName="Add">
1471       <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add (string prototype, string description, Action&lt;string&gt; action, bool hidden);" />
1472       <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add(string prototype, string description, class System.Action`1&lt;string&gt; action, bool hidden) cil managed" />
1473       <MemberType>Method</MemberType>
1474       <AssemblyInfo>
1475         <AssemblyVersion>0.2.3.0</AssemblyVersion>
1476       </AssemblyInfo>
1477       <ReturnValue>
1478         <ReturnType>Mono.Options.OptionSet</ReturnType>
1479       </ReturnValue>
1480       <Parameters>
1481         <Parameter Name="prototype" Type="System.String" />
1482         <Parameter Name="description" Type="System.String" />
1483         <Parameter Name="action" Type="System.Action&lt;System.String&gt;" />
1484         <Parameter Name="hidden" Type="System.Boolean" />
1485       </Parameters>
1486       <Docs>
1487         <param name="prototype">
1488           A <see cref="T:System.String" /> containing all option aliases to
1489           register, an (optional) type specifier, and an (optional) value
1490           separator list; see
1491           <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
1492           for details.
1493         </param>
1494         <param name="description">
1495           A <see cref="T:System.String" /> containing to used to initialize
1496           the <see cref="P:Mono.Options.Option.Description" /> property.
1497         </param>
1498         <param name="action">
1499           A <see cref="T:System.Action{System.String}" />
1500           to invoke when an option is parsed.
1501         </param>
1502         <param name="hidden">
1503           A <see cref="T:System.Boolean" /> specifying whether or not the
1504           Option should be displayed in
1505           <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions" />.
1506         </param>
1507         <summary>
1508           Registers each alias within <paramref name="prototype" /> so that any
1509           options matching the aliases in <paramref name="prototype" /> will be
1510           handled by <paramref name="action" /> during any subsequent
1511           <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
1512           calls.
1513         </summary>
1514         <returns>
1515           The current <see cref="T:Mono.Options.OptionSet" /> instance.
1516           This is to permit method chaining.
1517         </returns>
1518         <remarks>
1519         </remarks>
1520         <altmember cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />
1521         <exception cref="T:System.ArgumentException">
1522           <paramref name="option" /> has an alias (as returned from
1523           <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
1524           a previously registered <see cref="T:Mono.Options.Option" />.
1525         </exception>
1526         <exception cref="T:System.ArgumentNullException">
1527           <para>
1528             <paramref name="prototype" /> is <see langword="null" /></para>
1529           <para>-or-</para>
1530           <para>
1531             <paramref name="action" /> is <see langword="null" /></para>
1532         </exception>
1533       </Docs>
1534     </Member>
1535     <Member MemberName="Add&lt;T&gt;">
1536       <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add&lt;T&gt; (string prototype, Action&lt;T&gt; action);" />
1537       <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add&lt;T&gt;(string prototype, class System.Action`1&lt;!!T&gt; action) cil managed" />
1538       <MemberType>Method</MemberType>
1539       <AssemblyInfo>
1540         <AssemblyVersion>0.2.0.0</AssemblyVersion>
1541         <AssemblyVersion>0.2.1.0</AssemblyVersion>
1542         <AssemblyVersion>0.2.2.0</AssemblyVersion>
1543         <AssemblyVersion>0.2.3.0</AssemblyVersion>
1544       </AssemblyInfo>
1545       <ReturnValue>
1546         <ReturnType>Mono.Options.OptionSet</ReturnType>
1547       </ReturnValue>
1548       <TypeParameters>
1549         <TypeParameter Name="T" />
1550       </TypeParameters>
1551       <Parameters>
1552         <Parameter Name="prototype" Type="System.String" />
1553         <Parameter Name="action" Type="System.Action&lt;T&gt;" />
1554       </Parameters>
1555       <Docs>
1556         <typeparam name="T">
1557           The type of the option to parse and provide to the 
1558           <paramref name="action" /> callback.
1559         </typeparam>
1560         <param name="prototype">
1561           A <see cref="T:System.String" /> containing all option aliases to
1562           register, an (optional) type specifier, and an (optional) value
1563           separator list; see 
1564           <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
1565           for details.
1566         </param>
1567         <param name="action">
1568           A <see cref="T:System.Action{``0}" />
1569           to invoke when an option is parsed.
1570         </param>
1571         <summary>
1572           Registers each alias within <paramref name="prototype" /> so that any 
1573           options matching the aliases in <paramref name="prototype" /> will be
1574           handled by <paramref name="action" /> during any subsequent
1575           <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
1576           calls.
1577         </summary>
1578         <returns>
1579           The current <see cref="T:Mono.Options.OptionSet" /> instance.
1580           This is to permit method chaining.
1581         </returns>
1582         <remarks>
1583           Calls 
1584           <see cref="M:Mono.Options.OptionSet.Add``1(System.String,System.String,System.Action{``0})" />
1585           with a <paramref name="description" /> value of 
1586           <see langword="null" />.
1587         </remarks>
1588         <altmember cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />
1589         <altmember cref="M:Mono.Options.OptionSet.Add``1(System.String,System.String,System.Action{``0})" />
1590         <exception cref="T:System.ArgumentException">
1591           <paramref name="option" /> has an alias (as returned from
1592           <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
1593           a previously registered <see cref="T:Mono.Options.Option" />.
1594         </exception>
1595       </Docs>
1596     </Member>
1597     <Member MemberName="Add&lt;T&gt;">
1598       <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add&lt;T&gt; (string prototype, string description, Action&lt;T&gt; action);" />
1599       <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add&lt;T&gt;(string prototype, string description, class System.Action`1&lt;!!T&gt; action) cil managed" />
1600       <MemberType>Method</MemberType>
1601       <AssemblyInfo>
1602         <AssemblyVersion>0.2.0.0</AssemblyVersion>
1603         <AssemblyVersion>0.2.1.0</AssemblyVersion>
1604         <AssemblyVersion>0.2.2.0</AssemblyVersion>
1605         <AssemblyVersion>0.2.3.0</AssemblyVersion>
1606       </AssemblyInfo>
1607       <ReturnValue>
1608         <ReturnType>Mono.Options.OptionSet</ReturnType>
1609       </ReturnValue>
1610       <TypeParameters>
1611         <TypeParameter Name="T" />
1612       </TypeParameters>
1613       <Parameters>
1614         <Parameter Name="prototype" Type="System.String" />
1615         <Parameter Name="description" Type="System.String" />
1616         <Parameter Name="action" Type="System.Action&lt;T&gt;" />
1617       </Parameters>
1618       <Docs>
1619         <typeparam name="T">
1620           The type of the option to parse and provide to the 
1621           <paramref name="action" /> callback.
1622         </typeparam>
1623         <param name="prototype">
1624           A <see cref="T:System.String" /> containing all option aliases to
1625           register, an (optional) type specifier, and an (optional) value
1626           separator list; see 
1627           <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
1628           for details.
1629         </param>
1630         <param name="description">
1631           A <see cref="T:System.String" /> containing to used to initialize
1632           the <see cref="P:Mono.Options.Option.Description" /> property.
1633         </param>
1634         <param name="action">
1635           A <see cref="T:System.Action{``0}" />
1636           to invoke when an option is parsed.
1637         </param>
1638         <summary>
1639           Registers each alias within <paramref name="prototype" /> so that any 
1640           options matching the aliases in <paramref name="prototype" /> will be
1641           handled by <paramref name="action" /> during any subsequent
1642           <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
1643           calls.
1644         </summary>
1645         <returns>
1646           The current <see cref="T:Mono.Options.OptionSet" /> instance.
1647           This is to permit method chaining.
1648         </returns>
1649         <remarks>
1650           <para>
1651             Use this typed overload when you want strongly typed option values
1652             that correspond to a managed type.
1653             <see cref="M:System.ComponentModel.TypeDescriptor.GetConverter(System.Type)" />
1654             is used to lookup the
1655             <see cref="T:System.ComponentModel.TypeConverter" /> to use when
1656             performing the string-to-type conversion.
1657           </para>
1658           <para>
1659             Special support is provided for <see cref="T:System.Nullable{X}" />
1660             types; <see cref="T:System.ComponentModel.TypeConverter" />
1661             doesn't currently support their use, but if 
1662             <typeparamref name="T" /> is a nullable type, then this method
1663             will instead use the 
1664             <see cref="T:System.ComponentModel.TypeConverter" /> for the 
1665             <typeparamref name="X" /> type.  This allows straightforward use
1666             of nullable types, identical to using any other strongly typed
1667             value.
1668           </para>
1669           <block subset="none" type="note">
1670             <para>
1671               If <paramref name="prototype" /> specifies an
1672               <see cref="F:Mono.Options.OptionValueType.Optional" /> value
1673               and the value is not provided, then <c>default(T)</c> is
1674               provided as the value to <paramref name="action" />.
1675             </para>
1676           </block>
1677         </remarks>
1678         <altmember cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />
1679         <exception cref="T:System.ArgumentException">
1680           <paramref name="option" /> has an alias (as returned from
1681           <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
1682           a previously registered <see cref="T:Mono.Options.Option" />.
1683         </exception>
1684         <exception cref="T:System.ArgumentNullException">
1685           <para>
1686             <paramref name="prototype" /> is <see langword="null" /></para>
1687           <para>-or-</para>
1688           <para>
1689             <paramref name="action" /> is <see langword="null" /></para>
1690         </exception>
1691       </Docs>
1692     </Member>
1693     <Member MemberName="Add&lt;TKey,TValue&gt;">
1694       <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add&lt;TKey,TValue&gt; (string prototype, Mono.Options.OptionAction&lt;TKey,TValue&gt; action);" />
1695       <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add&lt;TKey, TValue&gt;(string prototype, class Mono.Options.OptionAction`2&lt;!!TKey, !!TValue&gt; action) cil managed" />
1696       <MemberType>Method</MemberType>
1697       <AssemblyInfo>
1698         <AssemblyVersion>0.2.0.0</AssemblyVersion>
1699         <AssemblyVersion>0.2.1.0</AssemblyVersion>
1700         <AssemblyVersion>0.2.2.0</AssemblyVersion>
1701         <AssemblyVersion>0.2.3.0</AssemblyVersion>
1702       </AssemblyInfo>
1703       <ReturnValue>
1704         <ReturnType>Mono.Options.OptionSet</ReturnType>
1705       </ReturnValue>
1706       <TypeParameters>
1707         <TypeParameter Name="TKey" />
1708         <TypeParameter Name="TValue" />
1709       </TypeParameters>
1710       <Parameters>
1711         <Parameter Name="prototype" Type="System.String" />
1712         <Parameter Name="action" Type="Mono.Options.OptionAction&lt;TKey,TValue&gt;" />
1713       </Parameters>
1714       <Docs>
1715         <typeparam name="TKey">
1716           The type of the first argument to parse and provide to the 
1717           <paramref name="action" /> callback.
1718         </typeparam>
1719         <typeparam name="TValue">
1720           The type of the second argument to parse and provide to the 
1721           <paramref name="action" /> callback.
1722         </typeparam>
1723         <param name="prototype">
1724           A <see cref="T:System.String" /> containing all option aliases to
1725           register, an (optional) type specifier, and an (optional) value
1726           separator list; see 
1727           <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
1728           for details.
1729         </param>
1730         <param name="action">
1731           A <see cref="T:Mono.Options.OptionAction{TKey,TValue}" />
1732           to invoke when an option is parsed.
1733         </param>
1734         <summary>
1735           Registers each alias within <paramref name="prototype" /> so that any 
1736           options matching the aliases in <paramref name="prototype" /> will be
1737           handled by <paramref name="action" /> during any subsequent
1738           <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
1739           calls.
1740         </summary>
1741         <returns>
1742           The current <see cref="T:Mono.Options.OptionSet" /> instance.
1743           This is to permit method chaining.
1744         </returns>
1745         <remarks>
1746           Calls 
1747           <see cref="M:Mono.Options.OptionSet.Add``2(System.String,System.String,Mono.Options.OptionAction{``0,``1})" />
1748           with a <paramref name="description" /> value of 
1749           <see langword="null" />.
1750         </remarks>
1751         <altmember cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />
1752         <altmember cref="M:Mono.Options.OptionSet.Add``2(System.String,System.String,Mono.Options.OptionAction{``0,``1})" />
1753         <exception cref="T:System.ArgumentException">
1754           <paramref name="prototype" /> has an alias (as returned from
1755           <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
1756           a previously registered <see cref="T:Mono.Options.Option" />.
1757         </exception>
1758         <exception cref="T:System.ArgumentNullException">
1759           <para>
1760             <paramref name="prototype" /> is <see langword="null" /></para>
1761           <para>-or-</para>
1762           <para>
1763             <paramref name="action" /> is <see langword="null" /></para>
1764         </exception>
1765       </Docs>
1766     </Member>
1767     <Member MemberName="Add&lt;TKey,TValue&gt;">
1768       <MemberSignature Language="C#" Value="public Mono.Options.OptionSet Add&lt;TKey,TValue&gt; (string prototype, string description, Mono.Options.OptionAction&lt;TKey,TValue&gt; action);" />
1769       <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class Mono.Options.OptionSet Add&lt;TKey, TValue&gt;(string prototype, string description, class Mono.Options.OptionAction`2&lt;!!TKey, !!TValue&gt; action) cil managed" />
1770       <MemberType>Method</MemberType>
1771       <AssemblyInfo>
1772         <AssemblyVersion>0.2.0.0</AssemblyVersion>
1773         <AssemblyVersion>0.2.1.0</AssemblyVersion>
1774         <AssemblyVersion>0.2.2.0</AssemblyVersion>
1775         <AssemblyVersion>0.2.3.0</AssemblyVersion>
1776       </AssemblyInfo>
1777       <ReturnValue>
1778         <ReturnType>Mono.Options.OptionSet</ReturnType>
1779       </ReturnValue>
1780       <TypeParameters>
1781         <TypeParameter Name="TKey" />
1782         <TypeParameter Name="TValue" />
1783       </TypeParameters>
1784       <Parameters>
1785         <Parameter Name="prototype" Type="System.String" />
1786         <Parameter Name="description" Type="System.String" />
1787         <Parameter Name="action" Type="Mono.Options.OptionAction&lt;TKey,TValue&gt;" />
1788       </Parameters>
1789       <Docs>
1790         <typeparam name="TKey">
1791           The type of the first argument to parse and provide to the 
1792           <paramref name="action" /> callback.
1793         </typeparam>
1794         <typeparam name="TValue">
1795           The type of the second argument to parse and provide to the 
1796           <paramref name="action" /> callback.
1797         </typeparam>
1798         <param name="prototype">
1799           A <see cref="T:System.String" /> containing all option aliases to
1800           register, an (optional) type specifier, and an (optional) value
1801           separator list; see 
1802           <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
1803           for details.
1804         </param>
1805         <param name="description">
1806           A <see cref="T:System.String" /> to be used to initialize
1807           the <see cref="P:Mono.Options.Option.Description" /> property.
1808         </param>
1809         <param name="action">
1810           A <see cref="T:Mono.Options.OptionAction{TKey,TValue}" />
1811           to invoke when an option is parsed.
1812         </param>
1813         <summary>
1814           Registers each alias within <paramref name="prototype" /> so that any 
1815           options matching the aliases in <paramref name="prototype" /> will be
1816           handled by <paramref name="action" /> during any subsequent
1817           <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
1818           calls.
1819         </summary>
1820         <returns>
1821           The current <see cref="T:Mono.Options.OptionSet" /> instance.
1822           This is to permit method chaining.
1823         </returns>
1824         <remarks>
1825           <para>
1826             Use this method when <paramref name="prototype" /> should accept
1827             two typed values, generally a key and a value.
1828           </para>
1829           <block subset="none" type="note">
1830             <para>
1831               If <paramref name="prototype" /> specifies an
1832               <see cref="F:Mono.Options.OptionValueType.Optional" /> value
1833               and the value is not provided, then <c>default(TKey)</c> and
1834               <c>default(TValue)</c> may be provided as the values to
1835               <paramref name="action" />.
1836             </para>
1837           </block>
1838         </remarks>
1839         <altmember cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />
1840         <exception cref="T:System.ArgumentException">
1841           <paramref name="prototype" /> has an alias (as returned from
1842           <see cref="M:Mono.Options.Option.GetNames" />) that conflicts with
1843           a previously registered <see cref="T:Mono.Options.Option" />.
1844         </exception>
1845         <exception cref="T:System.ArgumentNullException">
1846           <para>
1847             <paramref name="prototype" /> is <see langword="null" /></para>
1848           <para>-or-</para>
1849           <para>
1850             <paramref name="action" /> is <see langword="null" /></para>
1851         </exception>
1852       </Docs>
1853     </Member>
1854     <Member MemberName="ArgumentSources">
1855       <MemberSignature Language="C#" Value="public System.Collections.ObjectModel.ReadOnlyCollection&lt;Mono.Options.ArgumentSource&gt; ArgumentSources { get; }" />
1856       <MemberSignature Language="ILAsm" Value=".property instance class System.Collections.ObjectModel.ReadOnlyCollection`1&lt;class Mono.Options.ArgumentSource&gt; ArgumentSources" />
1857       <MemberType>Property</MemberType>
1858       <AssemblyInfo>
1859         <AssemblyVersion>0.2.2.0</AssemblyVersion>
1860         <AssemblyVersion>0.2.3.0</AssemblyVersion>
1861       </AssemblyInfo>
1862       <ReturnValue>
1863         <ReturnType>System.Collections.ObjectModel.ReadOnlyCollection&lt;Mono.Options.ArgumentSource&gt;</ReturnType>
1864       </ReturnValue>
1865       <Docs>
1866         <summary>
1867           A collection of all
1868           <see cref="T:Mono.Options.ArgumentSource" />s which will be consulted during 
1869           <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
1870           processing.
1871         </summary>
1872         <value>
1873           A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection{Mono.Options.ArgumentSource}" />
1874           containing all <see cref="T:Mono.Options.ArgumentSource" />s which
1875           have been 
1876           <see cref="M:Mono.Options.OptionSet.Add(Mono.Options.ArgumentSource)" />ed.
1877         </value>
1878         <remarks>
1879         </remarks>
1880       </Docs>
1881     </Member>
1882     <Member MemberName="CreateOptionContext">
1883       <MemberSignature Language="C#" Value="protected virtual Mono.Options.OptionContext CreateOptionContext ();" />
1884       <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance class Mono.Options.OptionContext CreateOptionContext() cil managed" />
1885       <MemberType>Method</MemberType>
1886       <AssemblyInfo>
1887         <AssemblyVersion>0.2.0.0</AssemblyVersion>
1888         <AssemblyVersion>0.2.1.0</AssemblyVersion>
1889         <AssemblyVersion>0.2.2.0</AssemblyVersion>
1890         <AssemblyVersion>0.2.3.0</AssemblyVersion>
1891       </AssemblyInfo>
1892       <ReturnValue>
1893         <ReturnType>Mono.Options.OptionContext</ReturnType>
1894       </ReturnValue>
1895       <Parameters />
1896       <Docs>
1897         <summary>
1898           Creates an <see cref="T:Mono.Options.OptionContext" /> instance.
1899         </summary>
1900         <returns>
1901           A <see cref="T:Mono.Options.OptionContext" /> instance to be used
1902           when parsing all options during the current
1903           <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
1904           call.
1905         </returns>
1906         <remarks>
1907           <block subset="none" type="overrides">
1908             <para>
1909               This method can be overridden if
1910               <see cref="M:Mono.Options.OptionSet.Parse(System.String,Mono.Options.OptionContext)" />
1911               is overridden and requires access to an 
1912               <see cref="T:Mono.Options.OptionContext" /> subclass to store
1913               additional information during the current 
1914               <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
1915               invocation.
1916             </para>
1917           </block>
1918         </remarks>
1919         <altmember cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
1920         <altmember cref="M:Mono.Options.OptionSet.Parse(System.String,Mono.Options.OptionContext)" />
1921       </Docs>
1922     </Member>
1923     <Member MemberName="GetKeyForItem">
1924       <MemberSignature Language="C#" Value="protected override string GetKeyForItem (Mono.Options.Option item);" />
1925       <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance string GetKeyForItem(class Mono.Options.Option item) cil managed" />
1926       <MemberType>Method</MemberType>
1927       <AssemblyInfo>
1928         <AssemblyVersion>0.2.1.0</AssemblyVersion>
1929         <AssemblyVersion>0.2.2.0</AssemblyVersion>
1930         <AssemblyVersion>0.2.3.0</AssemblyVersion>
1931       </AssemblyInfo>
1932       <ReturnValue>
1933         <ReturnType>System.String</ReturnType>
1934       </ReturnValue>
1935       <Parameters>
1936         <Parameter Name="item" Type="Mono.Options.Option" />
1937       </Parameters>
1938       <Docs>
1939         <param name="item">
1940           An <see cref="T:Mono.Options.Option" /> to return the key of.
1941         </param>
1942         <summary>
1943           Returns <c><paramref name="item" />.GetNames()[0]</c>.
1944         </summary>
1945         <returns>
1946           A <see cref="T:System.String" /> containing the first alias returned
1947           by <see cref="M:Mono.Options.Option.GetNames" />.
1948         </returns>
1949         <remarks>
1950           <para>
1951             This is to support the 
1952             <see cref="T:System.Collections.ObjectModel.KeyedCollection{System.String,Mono.Options.Option}" />
1953             infrastructure.  
1954             <see cref="T:System.Collections.ObjectModel.KeyedCollection{System.String,Mono.Options.Option}" />
1955             assumes only one key per item, so we arbitrarily choose the first
1956             item in the option alias list.
1957           </para>
1958           <block subset="none" type="note">
1959             All aliases returned by 
1960             <see cref="M:Mono.Options.Option.GetNames" /> are still
1961             registered with 
1962             <see cref="T:System.Collections.ObjectModel.KeyedCollection{System.String,Mono.Options.Option}" />
1963             even though 
1964             <see cref="M:Mono.Options.OptionSet.GetKeyForItem(Mono.Options.Option)" />
1965             will never return them.  Consequently, 
1966             <see cref="M:System.Collections.ObjectModel.KeyedCollection{System.String,Mono.Options.Option}.Contains(`0)" />
1967             and
1968             <see cref="P:System.Collections.ObjectModel.KeyedCollection{System.String,Mono.Options.Option}.Item(`0)" />
1969             will both correctly use all aliases returned by 
1970             <see cref="M:Mono.Options.Option.GetNames" />.
1971           </block>
1972         </remarks>
1973       </Docs>
1974     </Member>
1975     <Member MemberName="GetOptionForName">
1976       <MemberSignature Language="C#" Value="protected Mono.Options.Option GetOptionForName (string option);" />
1977       <MemberSignature Language="ILAsm" Value=".method familyhidebysig instance class Mono.Options.Option GetOptionForName(string option) cil managed" />
1978       <MemberType>Method</MemberType>
1979       <AssemblyInfo>
1980         <AssemblyVersion>0.2.0.0</AssemblyVersion>
1981         <AssemblyVersion>0.2.1.0</AssemblyVersion>
1982         <AssemblyVersion>0.2.2.0</AssemblyVersion>
1983         <AssemblyVersion>0.2.3.0</AssemblyVersion>
1984       </AssemblyInfo>
1985       <Attributes>
1986         <Attribute>
1987           <AttributeName>System.Obsolete("Use KeyedCollection.this[string]")</AttributeName>
1988         </Attribute>
1989       </Attributes>
1990       <ReturnValue>
1991         <ReturnType>Mono.Options.Option</ReturnType>
1992       </ReturnValue>
1993       <Parameters>
1994         <Parameter Name="option" Type="System.String" />
1995       </Parameters>
1996       <Docs>
1997         <param name="option">
1998           A <see cref="T:System.String" /> containing the option name to
1999           lookup.
2000         </param>
2001         <summary>
2002           Looks up the <see cref="T:Mono.Options.Option" /> registered to
2003           handle the option name <paramref name="option" />.
2004         </summary>
2005         <returns>
2006           The <see cref="T:Mono.Options.Option" /> instance registered to
2007           handle the option name <paramref name="option" />.
2008           If there is no registered handler for <paramref name="option" />,
2009           then <see langword="null" /> is returned.
2010         </returns>
2011         <remarks>
2012           <para>
2013             Subclasses can use this function to perform 
2014             <paramref name="option" /> lookup when overriding
2015             <see cref="M:Mono.Options.OptionSet.Parse(System.String,Mono.Options.OptionContext)" />.
2016           </para>
2017         </remarks>
2018         <altmember cref="M:Mono.Options.OptionSet.Parse(System.String,Mono.Options.OptionContext)" />
2019         <exception cref="T:System.ArgumentNullException">
2020           <paramref name="option" /> is <see langword="null" />.
2021         </exception>
2022       </Docs>
2023     </Member>
2024     <Member MemberName="GetOptionParts">
2025       <MemberSignature Language="C#" Value="protected bool GetOptionParts (string argument, out string flag, out string name, out string sep, out string value);" />
2026       <MemberSignature Language="ILAsm" Value=".method familyhidebysig instance bool GetOptionParts(string argument, string flag, string name, string sep, string value) cil managed" />
2027       <MemberType>Method</MemberType>
2028       <AssemblyInfo>
2029         <AssemblyVersion>0.2.0.0</AssemblyVersion>
2030         <AssemblyVersion>0.2.1.0</AssemblyVersion>
2031         <AssemblyVersion>0.2.2.0</AssemblyVersion>
2032         <AssemblyVersion>0.2.3.0</AssemblyVersion>
2033       </AssemblyInfo>
2034       <ReturnValue>
2035         <ReturnType>System.Boolean</ReturnType>
2036       </ReturnValue>
2037       <Parameters>
2038         <Parameter Name="argument" Type="System.String" />
2039         <Parameter Name="flag" Type="System.String&amp;" RefType="out" />
2040         <Parameter Name="name" Type="System.String&amp;" RefType="out" />
2041         <Parameter Name="sep" Type="System.String&amp;" RefType="out" />
2042         <Parameter Name="value" Type="System.String&amp;" RefType="out" />
2043       </Parameters>
2044       <Docs>
2045         <param name="argument">
2046           A <see cref="T:System.String" /> containing the option to parse into
2047           its constituent parts.
2048         </param>
2049         <param name="flag">
2050           A <see cref="T:System.String" /> reference which will be set to 
2051           <see langword="null" /> if the method returns 
2052           <see langword="false" />, or set to the flag the option starts with
2053           if the method returns <see langword="true" />.
2054           Valid flags include: <c>-</c>, <c>--</c>, and <c>/</c>.
2055         </param>
2056         <param name="name">
2057           A <see cref="T:System.String" /> reference which will be set to 
2058           <see langword="null" /> if the method returns 
2059           <see langword="false" />, or set to the option name following a
2060           valid flag if the method returns <see langword="true" />.
2061           No lookup is made to determine that flag has been registered via a 
2062           prior call to 
2063           <see cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />
2064           or related overload.
2065         </param>
2066         <param name="sep">
2067           A <see cref="T:System.String" /> reference which will be set to 
2068           <see langword="null" /> if either the method returns 
2069           <see langword="false" /> or if <c>=</c> or <c>:</c> was not found
2070           within <paramref name="argument" />; if the method returns 
2071           <see langword="true" /> and <paramref name="argument" /> contains a
2072           <c>=</c> or <c>:</c>, then <paramref name="sep" /> will contain
2073           either <c>=</c> or <c>:</c>, whichever was found within 
2074           <paramref name="argument" />.
2075         </param>
2076         <param name="value">
2077           A <see cref="T:System.String" /> reference which will be set to 
2078           <see langword="null" /> if either the method returns 
2079           <see langword="false" /> or if <paramref name="sep" /> is null;
2080           if the method returns <see langword="true" /> and 
2081           <paramref name="sep" /> is not <see langword="null" />, then
2082           <paramref name="value" /> will contain all text after 
2083           <paramref name="sep" />.
2084         </param>
2085         <summary>
2086           Splits <paramref name="argument" /> into its constituent parts.
2087         </summary>
2088         <returns>
2089           <see langword="true" /> if <paramref name="argument" /> could be split
2090           into its constituent parts, and <paramref name="flag" /> and 
2091           <paramref name="name" /> are set (<paramref name="sep" /> and
2092           <paramref name="value" /> may not be set, depending on whether or
2093           not they are present within <paramref name="argument" />);
2094           <see langword="true" /> if <paramref name="argument" /> is not the
2095           possible start of a valid option.
2096         </returns>
2097         <remarks>
2098           <para>
2099             Subclasses can call this method from their 
2100             <see cref="M:Mono.Options.OptionSet.Parse(System.String,Mono.Options.OptionContext)" />
2101             method to determine whether a given string is an option, and to
2102             split the option up for further processing.
2103           </para>
2104           <para>
2105             For example, <c>GetOptionParts("foo", ...)</c> would return 
2106             <see langword="false" />, while 
2107             <c>GetOptionParts("--foo=bar", ...)</c>
2108             would result in <paramref name="flag" /> containing <c>--</c>, 
2109             <paramref name="name" /> containing <c>foo</c>, 
2110             <paramref name="sep" /> containing <c>=</c>, and
2111             <paramref name="value" /> containing <c>bar</c>.
2112           </para>
2113         </remarks>
2114         <exception cref="T:System.ArgumentNullException">
2115           <paramref name="argument" /> is <see langword="null" />.
2116         </exception>
2117       </Docs>
2118     </Member>
2119     <Member MemberName="InsertItem">
2120       <MemberSignature Language="C#" Value="protected override void InsertItem (int index, Mono.Options.Option item);" />
2121       <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void InsertItem(int32 index, class Mono.Options.Option item) cil managed" />
2122       <MemberType>Method</MemberType>
2123       <AssemblyInfo>
2124         <AssemblyVersion>0.2.0.0</AssemblyVersion>
2125         <AssemblyVersion>0.2.1.0</AssemblyVersion>
2126         <AssemblyVersion>0.2.2.0</AssemblyVersion>
2127         <AssemblyVersion>0.2.3.0</AssemblyVersion>
2128       </AssemblyInfo>
2129       <ReturnValue>
2130         <ReturnType>System.Void</ReturnType>
2131       </ReturnValue>
2132       <Parameters>
2133         <Parameter Name="index" Type="System.Int32" />
2134         <Parameter Name="item" Type="Mono.Options.Option" />
2135       </Parameters>
2136       <Docs>
2137         <param name="index">
2138           A <see cref="T:System.Int32" /> specifying the index to insert 
2139           <paramref name="item" /> into.
2140         </param>
2141         <param name="item">
2142           The <see cref="T:Mono.Options.Option" /> to insert.
2143         </param>
2144         <summary>
2145           Inserts <paramref name="item" /> at the specified 
2146           <paramref name="index" />.
2147         </summary>
2148         <remarks>
2149         </remarks>
2150       </Docs>
2151     </Member>
2152     <Member MemberName="MessageLocalizer">
2153       <MemberSignature Language="C#" Value="public Converter&lt;string,string&gt; MessageLocalizer { get; }" />
2154       <MemberSignature Language="ILAsm" Value=".property instance class System.Converter`2&lt;string, string&gt; MessageLocalizer" />
2155       <MemberType>Property</MemberType>
2156       <AssemblyInfo>
2157         <AssemblyVersion>0.2.0.0</AssemblyVersion>
2158         <AssemblyVersion>0.2.1.0</AssemblyVersion>
2159         <AssemblyVersion>0.2.2.0</AssemblyVersion>
2160         <AssemblyVersion>0.2.3.0</AssemblyVersion>
2161       </AssemblyInfo>
2162       <ReturnValue>
2163         <ReturnType>System.Converter&lt;System.String,System.String&gt;</ReturnType>
2164       </ReturnValue>
2165       <Docs>
2166         <summary>
2167           Permits access to the message localization facility.
2168         </summary>
2169         <value>
2170           A <see cref="T:System.Converter{System.String,System.String}" />
2171           that can be used to localize messages.
2172         </value>
2173         <remarks>
2174           <para>
2175             <see cref="T:Mono.Options.Option" /> subclasses can use this
2176             property 
2177             (via <see cref="P:Mono.Options.OptionContext.OptionSet" />) to
2178             perform message localization for their own exception messages.
2179           </para>
2180         </remarks>
2181         <altmember cref="C:Mono.Options.OptionSet(System.Converter{System.String,System.String})" />
2182       </Docs>
2183     </Member>
2184     <Member MemberName="Parse">
2185       <MemberSignature Language="C#" Value="public System.Collections.Generic.List&lt;string&gt; Parse (System.Collections.Generic.IEnumerable&lt;string&gt; arguments);" />
2186       <MemberSignature Language="ILAsm" Value=".method public hidebysig instance class System.Collections.Generic.List`1&lt;string&gt; Parse(class System.Collections.Generic.IEnumerable`1&lt;string&gt; arguments) cil managed" />
2187       <MemberType>Method</MemberType>
2188       <AssemblyInfo>
2189         <AssemblyVersion>0.2.0.0</AssemblyVersion>
2190         <AssemblyVersion>0.2.1.0</AssemblyVersion>
2191         <AssemblyVersion>0.2.2.0</AssemblyVersion>
2192         <AssemblyVersion>0.2.3.0</AssemblyVersion>
2193       </AssemblyInfo>
2194       <ReturnValue>
2195         <ReturnType>System.Collections.Generic.List&lt;System.String&gt;</ReturnType>
2196       </ReturnValue>
2197       <Parameters>
2198         <Parameter Name="arguments" Type="System.Collections.Generic.IEnumerable&lt;System.String&gt;" />
2199       </Parameters>
2200       <Docs>
2201         <param name="arguments">
2202           A <see cref="T:System.Collections.Generic.IEnumerable&lt;System.String&gt;" />
2203           containing all arguments to parse.
2204         </param>
2205         <summary>
2206           Parses each <see cref="T:System.String" /> within 
2207           <paramref name="arguments" />, invoking any registered
2208           <paramref name="actions" /> if a registered option is encountered.
2209         </summary>
2210         <returns>
2211           A <see cref="T:System.Collections.Generic.List{System.String}" />
2212           containing all unhandled arguments.
2213         </returns>
2214         <remarks>
2215           <para>
2216             <c>Parse</c> looks at each argument from <paramref name="arguments" /> in order, passing each argument to each
2217             <see cref="T:Mono.Options.ArgumentSource" /> within
2218             <see cref="P:Mono.Options.OptionSet.ArgumentSources" /> using
2219             <see cref="M:Mono.Options.ArgumentSource.GetArguments(System.Int32, System.Collections.Generic.IEnumerable{System.String}@)" />
2220             until a source returns <see langword="true" /> (and the
2221             replacement sequence is used) or no <c>ArgumentSource</c> supports
2222             the argument.  <c>Parse</c> then attempts to process argument as
2223             an option.
2224           </para>
2225           <para>
2226             An argument is unhandled if:
2227           </para>
2228           <list type="bullet">
2229             <item>
2230               <term>
2231               There is no default handler registered (the <c>&lt;&gt;</c>
2232               handler).  If there is a default handler registered, then the
2233               default handler is invoked for otherwise-unhandled arguments.
2234             </term>
2235             </item>
2236             <item>
2237               <term>
2238               The option starts with a flag such as <c>-</c>, <c>--</c>,
2239               <c>/</c>, and the option name following the flag is
2240               unregistered.
2241             </term>
2242             </item>
2243             <item>
2244               <term>
2245               Or, the option does not start with a flag, and there is no prior
2246               parsed option that accepts a value that would use the argument as
2247               its value.
2248             </term>
2249             </item>
2250           </list>
2251           <para>
2252             Furthermore, argument parsing (including default handler invocation)
2253             stops whenever the <c>--</c> option is
2254             encountered.  This is in accordance with GNU conventions, and
2255             is frequently used to permit users to provide option-like
2256             filenames, e.g. <c>ls -lF -- -l</c> to view the file <c>-l</c>
2257             instead of needing to use <c>ls -lF ./-l</c>.
2258           </para>
2259         </remarks>
2260         <exception cref="T:Mono.Options.OptionException">
2261           <para>
2262             A value was not found for an <see cref="T:Mono.Options.Option" />
2263             requiring a value.
2264           </para>
2265           <para>-or-</para>
2266           <para>
2267             An attempt was made to bundle together an option requiring a
2268             value.
2269           </para>
2270           <para>-or-</para>
2271           <para>
2272             An exception was generated when trying to convert the value to the
2273             type <typeparamref name="T" />, for options added with
2274             <see cref="M:Mono.Options.OptionSet.Add``1(System.String,System.String,System.Action{``0})" />
2275             and related methods.  The originating exception is provided via
2276             the <see cref="P:System.Exception.InnerException" /> property.
2277           </para>
2278         </exception>
2279         <example>
2280           <para>
2281             The following example demonstrates some simple usage of 
2282             <see cref="T:Mono.Options.OptionSet" />.
2283           </para>
2284           <code lang="C#" src="examples/greet.cs">using System;
2285 using System.Collections.Generic;
2286 using Mono.Options;
2287
2288 class Test {
2289         static int verbosity;
2290
2291         public static void Main (string[] args)
2292         {
2293                 bool show_help = false;
2294                 List&lt;string&gt; names = new List&lt;string&gt; ();
2295                 int repeat = 1;
2296
2297                 var p = new OptionSet () {
2298                         "Usage: greet [OPTIONS]+ message",
2299                         "Greet a list of individuals with an optional message.",
2300                         "If no message is specified, a generic greeting is used.",
2301                         "",
2302                         "Options:",
2303                         { "n|name=", "the {NAME} of someone to greet.",
2304                           v =&gt; names.Add (v) },
2305                         { "r|repeat=", 
2306                                 "the number of {TIMES} to repeat the greeting.\n" + 
2307                                         "this must be an integer.",
2308                           (int v) =&gt; repeat = v },
2309                         { "v", "increase debug message verbosity",
2310                           v =&gt; { if (v != null) ++verbosity; } },
2311                         { "h|help",  "show this message and exit", 
2312                           v =&gt; show_help = v != null },
2313                 };
2314
2315                 List&lt;string&gt; extra;
2316                 try {
2317                         extra = p.Parse (args);
2318                 }
2319                 catch (OptionException e) {
2320                         Console.Write ("greet: ");
2321                         Console.WriteLine (e.Message);
2322                         Console.WriteLine ("Try `greet --help' for more information.");
2323                         return;
2324                 }
2325
2326                 if (show_help) {
2327                         p.WriteOptionDescriptions (Console.Out);
2328                         return;
2329                 }
2330
2331                 string message;
2332                 if (extra.Count &gt; 0) {
2333                         message = string.Join (" ", extra.ToArray ());
2334                         Debug ("Using new message: {0}", message);
2335                 }
2336                 else {
2337                         message = "Hello {0}!";
2338                         Debug ("Using default message: {0}", message);
2339                 }
2340
2341                 foreach (string name in names) {
2342                         for (int i = 0; i &lt; repeat; ++i)
2343                                 Console.WriteLine (message, name);
2344                 }
2345         }
2346
2347         static void Debug (string format, params object[] args)
2348         {
2349                 if (verbosity &gt; 0) {
2350                         Console.Write ("# ");
2351                         Console.WriteLine (format, args);
2352                 }
2353         }
2354 }
2355
2356 </code>
2357         </example>
2358       </Docs>
2359     </Member>
2360     <Member MemberName="Parse">
2361       <MemberSignature Language="C#" Value="protected virtual bool Parse (string argument, Mono.Options.OptionContext c);" />
2362       <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance bool Parse(string argument, class Mono.Options.OptionContext c) cil managed" />
2363       <MemberType>Method</MemberType>
2364       <AssemblyInfo>
2365         <AssemblyVersion>0.2.0.0</AssemblyVersion>
2366         <AssemblyVersion>0.2.1.0</AssemblyVersion>
2367         <AssemblyVersion>0.2.2.0</AssemblyVersion>
2368         <AssemblyVersion>0.2.3.0</AssemblyVersion>
2369       </AssemblyInfo>
2370       <ReturnValue>
2371         <ReturnType>System.Boolean</ReturnType>
2372       </ReturnValue>
2373       <Parameters>
2374         <Parameter Name="argument" Type="System.String" />
2375         <Parameter Name="c" Type="Mono.Options.OptionContext" />
2376       </Parameters>
2377       <Docs>
2378         <param name="argument">
2379           A <see cref="T:System.String" /> containing the current option to
2380           parse.
2381         </param>
2382         <param name="c">
2383           A <see cref="T:Mono.Options.OptionContext" /> containing the
2384           current parser context.
2385         </param>
2386         <summary>
2387           Parses <paramref name="argument" /> and invokes
2388           <see cref="M:Mono.Options.Option.Invoke(Mono.Options.OptionContext)" /> 
2389           if appropriate.
2390         </summary>
2391         <returns>
2392           A <see cref="T:System.Boolean" /> specifying whether or not
2393           <paramref name="argument" /> was handled.
2394           If <see langword="false" />, then
2395           <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
2396           will return <paramref name="argument" /> as an unhandled option.
2397         </returns>
2398         <remarks>
2399           <para>
2400             This method is called for each <see cref="T:System.String" />
2401             within the <see cref="T:System.Collections.Generic.IEnumerable{System.String}" />
2402             provided to 
2403             <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />,
2404             which thus gives this method a chance to parse a single option, or
2405             chain together multiple options to form a single option (as is
2406             necessary when an option and its value are separated, e.g. with
2407             <c>-option value</c>).
2408           </para>
2409           <block subset="none" type="behaviors">
2410             <para>
2411               The default implementation will check 
2412               <see cref="P:Mono.Options.OptionContext.Option" />, which is
2413               assumed to be a <see cref="T:Mono.Options.Option" /> in need of
2414               a value.  If 
2415               <see cref="P:Mono.Options.OptionContext.Option" /> is 
2416               non-<see langword="null" />, then <paramref name="argument" />
2417               is 
2418               <see cref="M:Mono.Options.OptionValueCollection.Add(System.String)" />ed
2419               to <see cref="P:Mono.Options.OptionContext.OptionValues" /> and
2420               <see cref="M:Mono.Options.Option.Invoke(Mono.Options.OptionContext)" />
2421               is invoked.
2422             </para>
2423             <para>
2424               Next, <see cref="M:Mono.Options.OptionSet.GetOptionParts(System.String,System.String@,System.String@,System.String@,System.String@)" />
2425               is invoked.  If <c>GetOptionParts</c> returns 
2426               <see langword="false" />, then <see langword="false" /> is
2427               returned from <c>Parse</c>.
2428             </para>
2429             <para>
2430               Finally, check to see if the <paramref name="name" /> returned
2431               from <c>GetOptionParts</c> is registered; if it is, handle it
2432               appropriately.  If it isn't, check to see if 
2433               <paramref name="name" /> is a bundled option or a boolean
2434               option.  If <paramref name="name" /> isn't any registered
2435               option, then <see langword="false" /> is returned.
2436               Otherwise, <see langword="true" /> is returned.
2437             </para>
2438           </block>
2439           <block subset="none" type="overrides">
2440             <para>
2441               Inheriting types can override this method if they want to
2442               customize the per-option parsing within the containing
2443               <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
2444               invocation.
2445             </para>
2446             <para>
2447               Inheriting types should consider overriding 
2448               <see cref="M:Mono.Options.OptionSet.CreateOptionContext" />
2449               if they want to store extra information for use and retrieval
2450               during each <c>Parse</c> invocation.
2451             </para>
2452           </block>
2453         </remarks>
2454         <altmember cref="M:Mono.Options.OptionSet.CreateOptionContext" />
2455         <altmember cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
2456       </Docs>
2457     </Member>
2458     <Member MemberName="RemoveItem">
2459       <MemberSignature Language="C#" Value="protected override void RemoveItem (int index);" />
2460       <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void RemoveItem(int32 index) cil managed" />
2461       <MemberType>Method</MemberType>
2462       <AssemblyInfo>
2463         <AssemblyVersion>0.2.0.0</AssemblyVersion>
2464         <AssemblyVersion>0.2.1.0</AssemblyVersion>
2465         <AssemblyVersion>0.2.2.0</AssemblyVersion>
2466         <AssemblyVersion>0.2.3.0</AssemblyVersion>
2467       </AssemblyInfo>
2468       <ReturnValue>
2469         <ReturnType>System.Void</ReturnType>
2470       </ReturnValue>
2471       <Parameters>
2472         <Parameter Name="index" Type="System.Int32" />
2473       </Parameters>
2474       <Docs>
2475         <param name="index">
2476           A <see cref="T:System.Int32" /> containing the index of the 
2477           <see cref="T:Mono.Options.Option" /> to remove.
2478         </param>
2479         <summary>
2480           Removes the <see cref="T:Mono.Options.Option" /> at the specified
2481           <paramref name="index" />.
2482         </summary>
2483         <remarks>
2484         </remarks>
2485       </Docs>
2486     </Member>
2487     <Member MemberName="SetItem">
2488       <MemberSignature Language="C#" Value="protected override void SetItem (int index, Mono.Options.Option item);" />
2489       <MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void SetItem(int32 index, class Mono.Options.Option item) cil managed" />
2490       <MemberType>Method</MemberType>
2491       <AssemblyInfo>
2492         <AssemblyVersion>0.2.0.0</AssemblyVersion>
2493         <AssemblyVersion>0.2.1.0</AssemblyVersion>
2494         <AssemblyVersion>0.2.2.0</AssemblyVersion>
2495         <AssemblyVersion>0.2.3.0</AssemblyVersion>
2496       </AssemblyInfo>
2497       <ReturnValue>
2498         <ReturnType>System.Void</ReturnType>
2499       </ReturnValue>
2500       <Parameters>
2501         <Parameter Name="index" Type="System.Int32" />
2502         <Parameter Name="item" Type="Mono.Options.Option" />
2503       </Parameters>
2504       <Docs>
2505         <param name="index">
2506           A <see cref="T:System.Int32" /> containing the index of the 
2507           <see cref="T:Mono.Options.Option" /> to change.
2508         </param>
2509         <param name="item">
2510           The new <see cref="T:Mono.Options.Option" /> to set at
2511           <paramref name="index" />.
2512         </param>
2513         <summary>
2514           Removes the current <see cref="T:Mono.Options.Option" /> at 
2515           <paramref name="index" /> and sets <paramref name="item" /> 
2516           as the value for the <paramref name="index" /> value.
2517         </summary>
2518         <remarks>
2519         </remarks>
2520       </Docs>
2521     </Member>
2522     <Member MemberName="WriteOptionDescriptions">
2523       <MemberSignature Language="C#" Value="public void WriteOptionDescriptions (System.IO.TextWriter o);" />
2524       <MemberSignature Language="ILAsm" Value=".method public hidebysig instance void WriteOptionDescriptions(class System.IO.TextWriter o) cil managed" />
2525       <MemberType>Method</MemberType>
2526       <AssemblyInfo>
2527         <AssemblyVersion>0.2.0.0</AssemblyVersion>
2528         <AssemblyVersion>0.2.1.0</AssemblyVersion>
2529         <AssemblyVersion>0.2.2.0</AssemblyVersion>
2530         <AssemblyVersion>0.2.3.0</AssemblyVersion>
2531       </AssemblyInfo>
2532       <ReturnValue>
2533         <ReturnType>System.Void</ReturnType>
2534       </ReturnValue>
2535       <Parameters>
2536         <Parameter Name="o" Type="System.IO.TextWriter" />
2537       </Parameters>
2538       <Docs>
2539         <param name="o">
2540           The <see cref="T:System.IO.TextWriter" /> to write option
2541           descriptions to.
2542         </param>
2543         <summary>
2544           Writes <see cref="T:Mono.Options.Option" /> documentation to 
2545           <paramref name="o" />.
2546         </summary>
2547         <remarks>
2548           <para>
2549             Writes <see cref="T:Mono.Options.Option" /> documentation to
2550             <paramref name="o" />.
2551           </para>
2552           <para>
2553             If <see cref="P:Mono.Options.Option.Hidden" /> is
2554             <see langword="true" />, then the Option will not be written to
2555             <paramref name="o" />.
2556           </para>
2557           <para>
2558             For each <see cref="T:Mono.Options.Option" /> previously added to
2559             the current instance, this method writes out a comma-separated
2560             list of all <see cref="M:Mono.Options.Option.GetNames" />
2561             followed by the <see cref="P:Mono.Options.Option.Description" />.
2562           </para>
2563           <para>
2564             The <see cref="P:Mono.Options.Option.Description" /> is
2565             automatically wrapped so that output will flow nicely across
2566             multiple lines.  Wrapping is preferred at explicit embedded 
2567             newline characters (<c>\n</c>) or spaces, but words will be split
2568             (by adding a <c>-</c>) if necessary.
2569           </para>
2570           <para>
2571             Options requiring a value have <c>=VALUE</c> appended to their
2572             last name, while options with an optional value have
2573             <c>[=VALUE]</c> appended to their last name.
2574             The <c>VALUE</c> string can be changed by using a format
2575             specifier-like string within the 
2576             <see cref="P:Mono.Options.Option.Description" />.
2577           </para>
2578           <para>
2579             For <see cref="T:Mono.Options.Option" />s accepting one value,
2580             the string <c>{VALUE}</c> or <c>{0:VALUE}</c> can be used to
2581             explicitly provide the value name.  For <c>Option</c>s accepting
2582             more than one value, the leading number is used to specify which
2583             value the string is for.
2584           </para>
2585           <para>
2586             Once all <see cref="T:Mono.Options.Option" />s have been written,
2587             all <see cref="T:Mono.Options.ArgumentSource" />s are printed out
2588             using <see cref="M:Mono.Options.ArgumentSource.GetNames" /> and
2589             <see cref="P:Mono.Options.ArgumentSource.Description" />.
2590           </para>
2591         </remarks>
2592         <example>
2593           <para>
2594             The following example initializes a
2595             <see cref="T:Mono.Options.OptionSet" /> instance to accept a
2596             variety of parameters and provides a description for each
2597             parameter:
2598           </para>
2599           <code lang="C#" src="examples/greet.cs">using System;
2600 using System.Collections.Generic;
2601 using Mono.Options;
2602
2603 class Test {
2604         static int verbosity;
2605
2606         public static void Main (string[] args)
2607         {
2608                 bool show_help = false;
2609                 List&lt;string&gt; names = new List&lt;string&gt; ();
2610                 int repeat = 1;
2611
2612                 var p = new OptionSet () {
2613                         "Usage: greet [OPTIONS]+ message",
2614                         "Greet a list of individuals with an optional message.",
2615                         "If no message is specified, a generic greeting is used.",
2616                         "",
2617                         "Options:",
2618                         { "n|name=", "the {NAME} of someone to greet.",
2619                           v =&gt; names.Add (v) },
2620                         { "r|repeat=", 
2621                                 "the number of {TIMES} to repeat the greeting.\n" + 
2622                                         "this must be an integer.",
2623                           (int v) =&gt; repeat = v },
2624                         { "v", "increase debug message verbosity",
2625                           v =&gt; { if (v != null) ++verbosity; } },
2626                         { "h|help",  "show this message and exit", 
2627                           v =&gt; show_help = v != null },
2628                 };
2629
2630                 List&lt;string&gt; extra;
2631                 try {
2632                         extra = p.Parse (args);
2633                 }
2634                 catch (OptionException e) {
2635                         Console.Write ("greet: ");
2636                         Console.WriteLine (e.Message);
2637                         Console.WriteLine ("Try `greet --help' for more information.");
2638                         return;
2639                 }
2640
2641                 if (show_help) {
2642                         p.WriteOptionDescriptions (Console.Out);
2643                         return;
2644                 }
2645
2646                 string message;
2647                 if (extra.Count &gt; 0) {
2648                         message = string.Join (" ", extra.ToArray ());
2649                         Debug ("Using new message: {0}", message);
2650                 }
2651                 else {
2652                         message = "Hello {0}!";
2653                         Debug ("Using default message: {0}", message);
2654                 }
2655
2656                 foreach (string name in names) {
2657                         for (int i = 0; i &lt; repeat; ++i)
2658                                 Console.WriteLine (message, name);
2659                 }
2660         }
2661
2662         static void Debug (string format, params object[] args)
2663         {
2664                 if (verbosity &gt; 0) {
2665                         Console.Write ("# ");
2666                         Console.WriteLine (format, args);
2667                 }
2668         }
2669 }
2670
2671 </code>
2672           <para>
2673             Notice that when the above program is invoked with the
2674             <c>--help</c> parameter, 
2675             <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions(System.IO.TextWriter)" />
2676             is used to generate the <see cref="T:Mono.Options.Option" />
2677             description, that the <c>--repeat</c> description spans
2678             multiple lines, and that format specifiers such as <c>{NAME}</c>
2679             are used to provide a description for the option value:
2680           </para>
2681           <code lang="sh" src="examples/greet.txt">$ mono greet.exe --help
2682 Usage: greet [OPTIONS]+ message
2683 Greet a list of individuals with an optional message.
2684 If no message is specified, a generic greeting is used.
2685
2686 Options:
2687   -n, --name=NAME            the NAME of someone to greet.
2688   -r, --repeat=TIMES         the number of TIMES to repeat the greeting.
2689                                this must be an integer.
2690   -v                         increase debug message verbosity
2691   -h, --help                 show this message and exit
2692
2693 $ mono greet.exe -v- -n A -name=B --name=C /name D -nE
2694 Hello A!
2695 Hello B!
2696 Hello C!
2697 Hello D!
2698 Hello E!
2699
2700 $ mono greet.exe -v -n E custom greeting for: {0}
2701 # Using new message: custom greeting for: {0}
2702 custom greeting for: E
2703
2704 $ mono greet.exe -r 3 -n A
2705 Hello A!
2706 Hello A!
2707 Hello A!
2708
2709 $ mono greet.exe -r not-an-int
2710 greet: Could not convert string `not-an-int' to type Int32 for option `-r'.
2711 Try `greet --help' for more information.
2712 </code>
2713         </example>
2714       </Docs>
2715     </Member>
2716   </Members>
2717 </Type>