859bb4be2964c89678e6a66551c1fe29a30d48f1
[mono.git] / mcs / class / Mono.Options / Documentation / en / Mono.Options / Option.xml
1 <Type Name="Option" FullName="Mono.Options.Option">
2   <TypeSignature Language="C#" Value="public abstract class Option" />
3   <AssemblyInfo>
4     <AssemblyName>Mono.Options</AssemblyName>
5     <AssemblyVersion>0.2.0.0</AssemblyVersion>
6     <AssemblyVersion>0.2.1.0</AssemblyVersion>
7   </AssemblyInfo>
8   <ThreadingSafetyStatement>
9     All members of this type are safe for multithreaded operations.
10     Subclasses must be thread-safe if multithreaded invocation of 
11     <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable&lt;System.String&gt;)" />
12     is required.
13   </ThreadingSafetyStatement>
14   <Base>
15     <BaseTypeName>System.Object</BaseTypeName>
16   </Base>
17   <Interfaces />
18   <Docs>
19     <summary>
20       Represents information about an option.
21     </summary>
22     <remarks>
23       <para>
24         Instances of <see cref="T:Mono.Options.Option" /> are created via
25         the various <see cref="M:Mono.Options.OptionSet.Add" /> overloads, 
26         such as:
27       </para>
28       <list type="bullet">
29         <item>
30           <term>
31             <see cref="M:Mono.Options.OptionSet.Add(System.String,System.Action{System.String})" />
32           </term>
33         </item>
34         <item>
35           <term>
36             <see cref="M:Mono.Options.OptionSet.Add(System.String,System.String,System.Action{System.String})" />
37           </term>
38         </item>
39         <item>
40           <term>
41             <see cref="M:Mono.Options.OptionSet.Add(System.String,Mono.Options.OptionAction{System.String,System.String})" />
42           </term>
43         </item>
44         <item>
45           <term>
46             <see cref="M:Mono.Options.OptionSet.Add(System.String,System.String,Mono.Options.OptionAction{System.String,System.String})" />
47           </term>
48         </item>
49         <item>
50           <term>
51             <see cref="M:Mono.Options.OptionSet.Add``1(System.String,System.Action{``0})" />
52           </term>
53         </item>
54         <item>
55           <term>
56             <see cref="M:Mono.Options.OptionSet.Add``1(System.String,System.String,System.Action{``0})" />
57           </term>
58         </item>
59         <item>
60           <term>
61             <see cref="M:Mono.Options.OptionSet.Add``2(System.String,Mono.Options.OptionAction{``0,``1})" />
62           </term>
63         </item>
64         <item>
65           <term>
66             <see cref="M:Mono.Options.OptionSet.Add``2(System.String,System.String,Mono.Options.OptionAction{``0,``1})" />
67           </term>
68         </item>
69       </list>
70       <para>
71         You can also add custom <see cref="T:Mono.Options.Option" /> 
72         subclasses to an <see cref="T:Mono.Options.OptionSet" /> via the 
73         <see cref="M:Mono.Options.OptionSet.Add(Mono.Options.Option)" />
74         method.
75       </para>
76       <block subset="none" type="overrides">
77         Inheritors of this type must override the <see langword="abstract" /> method
78         <see cref="M:Mono.Options.Option.OnParseComplete(Mono.Options.OptionContext)" />,
79         which is (indirectly) invoked from within 
80         <see cref="M:Mono.Options.OptionSet.Parse(System.String,Mono.Options.OptionContext)" />
81         when an option matching one of the <paramref name="prototype" />
82         aliases is encountered.
83       </block>
84     </remarks>
85   </Docs>
86   <Members>
87     <Member MemberName=".ctor">
88       <MemberSignature Language="C#" Value="protected Option (string prototype, string description);" />
89       <MemberType>Constructor</MemberType>
90       <AssemblyInfo>
91         <AssemblyVersion>0.2.0.0</AssemblyVersion>
92         <AssemblyVersion>0.2.1.0</AssemblyVersion>
93       </AssemblyInfo>
94       <Parameters>
95         <Parameter Name="prototype" Type="System.String" />
96         <Parameter Name="description" Type="System.String" />
97       </Parameters>
98       <Docs>
99         <param name="prototype">
100           A <see cref="T:System.String" /> containing a <c>|</c>-separated
101           list of option names (aliases) and an optional value-type specifier.
102         </param>
103         <param name="description">
104           A <see cref="T:System.String" /> containing documentation for the
105           option.
106         </param>
107         <summary>
108           Creates and initializes a new instance of the 
109           <see cref="T:Mono.Options.Option" /> class.
110         </summary>
111         <remarks>
112           <para>
113             This constructor initializes the 
114             <see cref="P:Mono.Options.Option.Prototype" /> property of the
115             new instance using <paramref name="prototype" />, the 
116             <see cref="P:Mono.Options.Option.Description" /> property of the
117             new instance using <paramref name="description" />. and
118             initializes the <see cref="P:Mono.Options.Option.MaxValueCount" /> 
119             property of the new instance to <c>1</c>.
120           </para>
121           <para>
122             This is equivalent to calling the 
123             <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
124             constructor as with <c>Option(<paramref name="prototype" />, 
125             <paramref name="description" />, 1)</c>.
126           </para>
127         </remarks>
128         <exception cref="T:System.ArgumentException">
129           <para>
130             <paramref name="prototype" /> is the empty string <c>""</c>.
131           </para>
132           <para>-or-</para>
133           <para>
134             <paramref name="prototype" /> contains an empty alias, such as
135             <c>a||b</c>.
136           </para>
137           <para>-or-</para>
138           <para>
139             Conflicting <see cref="T:Mono.Options.OptionValueType" /> values
140             were found within <paramref name="prototype" />.
141           </para>
142           <para>-or-</para>
143           <para>
144             <paramref name="prototype" /> only includes the default handler
145             <c>&lt;&gt;</c> and <paramref name="prototype" /> did not specify an
146             <see cref="T:Mono.Options.OptionValueType" /> value of
147             <see cref="F:Mono.Options.OptionValueType.None" />.
148           </para>
149         </exception>
150         <exception cref="T:System.ArgumentNullException">
151           <paramref name="prototype" /> is <see langword="null" />.
152         </exception>
153       </Docs>
154     </Member>
155     <Member MemberName=".ctor">
156       <MemberSignature Language="C#" Value="protected Option (string prototype, string description, int maxValueCount);" />
157       <MemberType>Constructor</MemberType>
158       <AssemblyInfo>
159         <AssemblyVersion>0.2.0.0</AssemblyVersion>
160         <AssemblyVersion>0.2.1.0</AssemblyVersion>
161       </AssemblyInfo>
162       <Parameters>
163         <Parameter Name="prototype" Type="System.String" />
164         <Parameter Name="description" Type="System.String" />
165         <Parameter Name="maxValueCount" Type="System.Int32" />
166       </Parameters>
167       <Docs>
168         <param name="prototype">
169           A <see cref="T:System.String" /> containing a <c>|</c>-separated
170           list of option names (aliases) and an optional value-type specifier.
171         </param>
172         <param name="description">
173           A <see cref="T:System.String" /> containing documentation for the
174           option.
175         </param>
176         <param name="maxValueCount">
177           A <see cref="T:System.Int32" /> containing the number of values this
178           option accepts.
179         </param>
180         <summary>
181           Creates and initializes a new instance of the 
182           <see cref="T:Mono.Options.Option" /> class.
183         </summary>
184         <remarks>
185           <para>
186             This constructor initializes the 
187             <see cref="P:Mono.Options.Option.Prototype" /> property of the
188             new instance using <paramref name="prototype" />, the 
189             <see cref="P:Mono.Options.Option.Description" /> property of the
190             new instance using <paramref name="description" />. and
191             initializes the <see cref="P:Mono.Options.Option.MaxValueCount" /> 
192             property of the new instance using <paramref name="maxValueCount" />.
193           </para>
194           <para>
195             <paramref name="prototype" /> is a <c>|</c>-separated list of
196             option names.  It should be listed in shortest-to-longest order,
197             e.g. <c>h|help</c>.  <paramref name="prototype" /> may contain a
198             <see cref="T:Mono.Options.OptionValueType" /> specifier following
199             one of the <c>|</c>-separated entries, and a value separator list
200             following the <see cref="T:Mono.Options.OptionValueType" /> 
201             specifier.
202           </para>
203           <para>
204             The <see cref="P:Mono.Options.Option.OptionValueType" /> property
205             is initialized based on whether a <c>=</c> or <c>:</c> follows one
206             of the aliases within <paramref name="prototype" />.
207             <c>=</c> specifies a 
208             <see cref="F:Mono.Options.OptionValueType.Required" /> value,
209             while <c>:</c> specifies an 
210             <see cref="F:Mono.Options.OptionValueType.Optional" /> value.  
211             If neither <c>=</c> nor <c>:</c> is not specified, then 
212             <see cref="F:Mono.Options.OptionValueType.None" /> is used.
213             The value specifier may be used anywhere within 
214             <paramref name="prototype" />, so <c>n|name=</c>, <c>n=|name</c> 
215             and <c>n=|name=</c> are equivalent, but you cannot mix types; 
216             <c>n:|name=</c> is invalid.
217           </para>
218           <para>
219             A default handler may be specified by using <c>&lt;&gt;</c> as the
220             option name.  The default handler is invoked for any unhandled
221             argument within 
222                         <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />;
223             consequently, if a default handler is provided then
224                         <see cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
225             will return an empty 
226             <see cref="T:System.Collections.Generic.List{System.String}" />.
227           </para>
228           <para>
229             The default handler may either be provided as a stand-alone 
230             <see cref="T:Mono.Options.Option" />, in which case it may not
231             specify a <see cref="T:Mono.Options.OptionValueType" /> other
232             than <see cref="F:Mono.Options.OptionValueType.None" />.
233             Alternatively, it may be an alias, in which case the 
234             <see cref="T:Mono.Options.Option" /> must accept an
235             <see cref="F:Mono.Options.OptionValueType.Optional" /> or
236             <see cref="F:Mono.Options.OptionValueType.Required" /> value, and
237             <paramref name="maxValueCount" /> must be <c>1</c>.
238           </para>
239           <para>
240             Multiple values may be bundled together, such as 
241             <c>-opt key=value</c>.  The value separator list specifies which
242             characters can be used to split the value argument to generate
243             separate values.  The value separator list is available when 
244             <paramref name="maxValueCount" /> is greater than <c>1</c>, and
245             and an <see cref="T:Mono.Options.OptionValueType" /> was
246             specified.  The value separator list follows the <c>=</c> or
247             <c>:</c> and is one of the following:
248           </para>
249           <list type="bullet">
250             <item>
251               <term>
252                 <para>
253                 A sequence of character enclosed by <c>{</c> and <c>}</c>.
254                 Multiple such sequences may be specified by listing the 
255                 <c>{...}</c> sequence multiple times.
256               </para>
257                 <para>
258                 The sequence <c>{}</c> requires that each value be a different 
259                 argument, and no argument splitting will be performed.
260                 This sequence has no effect if other separators are also
261                 listed (as separate arguments are always permitted for
262                 <see cref="F:Mono.Options.OptionValueType.Required" />
263                 values).
264               </para>
265               </term>
266             </item>
267             <item>
268               <term>
269               Any literal character other than <c>{</c> and <c>}</c>.
270             </term>
271             </item>
272           </list>
273           <para>
274             If the separator list is not provided, then <c>=:</c> is the
275             default separator list.
276           </para>
277           <para>
278             For example, the prototype <c>"A:+-*/"</c> would permit any of
279             `<c>+</c>', `<c>-</c>', `<c>*</c>', or `<c>/</c>' to be used to
280             split an argument into values, so <c>-A:5/2</c> would generate the
281             sequence of values <c>5</c> and <c>2</c> for the option <c>-A</c>.
282             Furthermore, the prototype <c>"A={--&gt;}{=&gt;}"</c> would permit
283             either the string <c>--&gt;</c> or the string <c>=&gt;</c> to be used,
284             so <c>-A A-&gt;B C</c> woud parse <c>A-&gt;B</c> as one value and
285             <c>C</c> as the other value, while <c>-A A--&gt;B C</c> would parse
286             <c>A</c> as one value and <c>B</c> as the other value while
287             <c>C</c> would be unhandled (unless the option required 3 values,
288             in which case <c>C</c> would be the 3rd value).
289           </para>
290         </remarks>
291         <exception cref="T:System.ArgumentException">
292           <para>
293             <paramref name="prototype" /> is the empty string <c>""</c>.
294           </para>
295           <para>-or-</para>
296           <para>
297             <paramref name="prototype" /> contains an empty alias, such as
298             <c>a||b</c>.
299           </para>
300           <para>-or-</para>
301           <para>
302             Conflicting <see cref="T:Mono.Options.OptionValueType" /> values
303             were found within <paramref name="prototype" />.
304           </para>
305           <para>-or-</para>
306           <para>
307             <paramref name="maxValueCount" /> is <c>0</c> and 
308             <paramref name="prototype" /> specified an
309             <see cref="T:Mono.Options.OptionValueType" /> value of
310             <see cref="F:Mono.Options.OptionValueType.Optional" /> or
311             <see cref="F:Mono.Options.OptionValueType.Required" />.
312           </para>
313           <para>-or-</para>
314           <para>
315             <paramref name="maxValueCount" /> is greater than <c>1</c> and
316             <paramref name="prototype" /> specified an
317             <see cref="T:Mono.Options.OptionValueType" /> value of
318             <see cref="F:Mono.Options.OptionValueType.None" />.
319           </para>
320           <para>-or-</para>
321           <para>
322             <paramref name="prototype" /> contains a separator list and
323             <paramref name="maxValueCount" /> is <c>0</c> or <c>1</c>.
324           </para>
325           <para>-or-</para>
326           <para>
327             <paramref name="prototype" /> contains a badly formatted 
328             separator list, such as <c>{{</c>, <c>}}</c>, <c>{{}</c>, etc.
329           </para>
330           <para>-or-</para>
331           <para>
332             <paramref name="prototype" /> only includes the default handler
333             <c>&lt;&gt;</c> and <paramref name="prototype" /> did not specify an
334             <see cref="T:Mono.Options.OptionValueType" /> value of
335             <see cref="F:Mono.Options.OptionValueType.None" />.
336           </para>
337           <para>-or-</para>
338           <para>
339             <paramref name="prototype" /> includes the default handler
340             <c>&lt;&gt;</c>, and <paramref name="MaxValueCount" /> is greater
341             than <c>1</c>.
342           </para>
343         </exception>
344         <exception cref="T:System.ArgumentNullException">
345           <paramref name="prototype" /> is <see langword="null" />.
346         </exception>
347       </Docs>
348     </Member>
349     <Member MemberName="Description">
350       <MemberSignature Language="C#" Value="public string Description { get; }" />
351       <MemberType>Property</MemberType>
352       <AssemblyInfo>
353         <AssemblyVersion>0.2.0.0</AssemblyVersion>
354         <AssemblyVersion>0.2.1.0</AssemblyVersion>
355       </AssemblyInfo>
356       <ReturnValue>
357         <ReturnType>System.String</ReturnType>
358       </ReturnValue>
359       <Docs>
360         <summary>
361           A <see cref="T:System.String" /> containing documentation for this
362           option.
363         </summary>
364         <value>
365           A <see cref="T:System.String" /> containing documentation for this
366           option.
367         </value>
368         <remarks>
369           This property is used to generate documentation within 
370           <see cref="M:Mono.Options.OptionSet.WriteOptionDescriptions(System.IO.TextWriter)" />.
371           The string returned is translated via the 
372           <paramref name="localizer" /> parameter provided to the
373           <see cref="C:Mono.Options.OptionSet(System.Converter{System.String,System.String})" />
374           constructor before being written to the 
375           <see cref="T:System.IO.TextWriter" /> instance.
376         </remarks>
377         <altmember cref="M:Mono.Options.OptionSet.WriteOptionDescriptions(System.IO.TextWriter)" />
378       </Docs>
379     </Member>
380     <Member MemberName="GetNames">
381       <MemberSignature Language="C#" Value="public string[] GetNames ();" />
382       <MemberType>Method</MemberType>
383       <AssemblyInfo>
384         <AssemblyVersion>0.2.0.0</AssemblyVersion>
385         <AssemblyVersion>0.2.1.0</AssemblyVersion>
386       </AssemblyInfo>
387       <ReturnValue>
388         <ReturnType>System.String[]</ReturnType>
389       </ReturnValue>
390       <Parameters />
391       <Docs>
392         <summary>Retrieves all name aliases that make up 
393           <see cref="P:Mono.Options.Option.Prototype" />.</summary>
394         <returns>
395           A <see cref="T:System.String" /> array containing all name aliases
396           for this <see cref="T:Mono.Options.Option" /> instance.
397         </returns>
398         <remarks>
399           The returned option names will not contain any 
400           <see cref="T:Mono.Options.OptionValueType" /> specifier that may be
401           within <see cref="P:Mono.Options.Option.Prototype" />.  
402           If <see cref="P:Mono.Options.Option.Prototype" /> is
403           <c>a=|b=|c=</c>, the array returned will contain <c>a</c>, <c>b</c>,
404           and <c>c</c>.
405         </remarks>
406       </Docs>
407     </Member>
408     <Member MemberName="GetValueSeparators">
409       <MemberSignature Language="C#" Value="public string[] GetValueSeparators ();" />
410       <MemberType>Method</MemberType>
411       <AssemblyInfo>
412         <AssemblyVersion>0.2.0.0</AssemblyVersion>
413         <AssemblyVersion>0.2.1.0</AssemblyVersion>
414       </AssemblyInfo>
415       <ReturnValue>
416         <ReturnType>System.String[]</ReturnType>
417       </ReturnValue>
418       <Parameters />
419       <Docs>
420         <summary>
421           Retreives all value separators, strings which are used to split an
422           argument into one or more values for the this 
423           <see cref="T:Mono.Options.Option" />.
424         </summary>
425         <returns>
426           A <see cref="T:System.String" /> array containing all strings that
427           should be used when splitting an argument into one or more values
428           for this <see cref="T:Mono.Options.Option" />.
429         </returns>
430         <remarks>
431           <para>
432             Value separators may be provided within 
433             <see cref="P:Mono.Options.Option.Prototype" /> only if:
434           </para>
435           <list type="bullet">
436             <item>
437               <term>
438                 <see cref="P:Mono.Options.Option.MaxValueCount" /> is greater than 1.
439             </term>
440             </item>
441             <item>
442               <term>
443                 <see cref="P:Mono.Options.Option.OptionValueType" /> is 
444               <see cref="F:Mono.Options.OptionValueType.Optional" /> or
445               <see cref="F:Mono.Options.OptionValueType.Required" />.
446             </term>
447             </item>
448           </list>
449           <para>
450             See the 
451             <see cref="C:Mono.Options.Option(System.String,System.String,System.Int32)" />
452             constructor for more information.
453           </para>
454         </remarks>
455       </Docs>
456     </Member>
457     <Member MemberName="Invoke">
458       <MemberSignature Language="C#" Value="public void Invoke (Mono.Options.OptionContext c);" />
459       <MemberType>Method</MemberType>
460       <AssemblyInfo>
461         <AssemblyVersion>0.2.0.0</AssemblyVersion>
462         <AssemblyVersion>0.2.1.0</AssemblyVersion>
463       </AssemblyInfo>
464       <ReturnValue>
465         <ReturnType>System.Void</ReturnType>
466       </ReturnValue>
467       <Parameters>
468         <Parameter Name="c" Type="Mono.Options.OptionContext" />
469       </Parameters>
470       <Docs>
471         <param name="c">
472           An <see cref="T:Mono.Options.OptionContext" /> instance containing
473           information about the option that was parsed.
474         </param>
475         <summary>
476           Invokes 
477           <see cref="M:Mono.Options.Option.OnParseComplete(Mono.Options.OptionContext)" />
478           then clears out <paramref name="c" />.
479         </summary>
480         <remarks>
481           <para>
482             This method is invoked from within 
483             <see cref="M:Mono.Options.OptionSet.Parse(System.String,Mono.Options.OptionContext)" />
484             when an option with a name from
485             <see cref="M:Mono.Options.Option.GetNames" /> is encountered and
486             matches the required number of values governed by
487             <see cref="P:Mono.Options.Option.OptionValueType" /> and
488             <see cref="P:Mono.Options.Option.MaxValueCount" />.
489           </para>
490           <block subset="none" type="behaviors">
491             <para>
492               This method invokes 
493               <see cref="M:Mono.Options.Option.OnParseComplete(Mono.Options.OptionContext)" />,
494               passing along <paramref name="c" /> unchanged, and then sets the 
495               <see cref="P:Mono.Options.OptionContext.Option" /> and
496               <see cref="P:Mono.Options.OptionContext.OptionName" />
497               properties to <see langword="null" />, and 
498               <see cref="M:Mono.Options.OptionValueCollection.Clear" />s out
499               <see cref="P:Mono.Options.OptionContext.OptionValues" />.
500             </para>
501           </block>
502         </remarks>
503         <altmember cref="M:Mono.Options.Option.OnParseComplete(Mono.Options.OptionContext)" />
504         <altmember cref="M:Mono.Options.OptionSet.Parse(System.String,Mono.Options.OptionContext)" />
505         <altmember cref="M:Mono.Options.OptionSet.Parse(System.Collections.Generic.IEnumerable{System.String})" />
506       </Docs>
507     </Member>
508     <Member MemberName="MaxValueCount">
509       <MemberSignature Language="C#" Value="public int MaxValueCount { get; }" />
510       <MemberType>Property</MemberType>
511       <AssemblyInfo>
512         <AssemblyVersion>0.2.0.0</AssemblyVersion>
513         <AssemblyVersion>0.2.1.0</AssemblyVersion>
514       </AssemblyInfo>
515       <ReturnValue>
516         <ReturnType>System.Int32</ReturnType>
517       </ReturnValue>
518       <Docs>
519         <summary>
520           A <see cref="T:System.Int32" /> containing the maximum number of
521           values this <see cref="T:Mono.Options.Option" /> accepts.
522         </summary>
523         <value>
524           A <see cref="T:System.Int32" /> containing the maximum number of
525           values this <see cref="T:Mono.Options.Option" /> accepts.
526         </value>
527         <remarks>
528           <para>
529             This is a maximum, and may not be the number of values present
530             within <see cref="P:Mono.Options.OptionContext.OptionValues" />
531             when 
532             <see cref="M:Mono.Options.Option.OnParseComplete(Mono.Options.OptionContext)" />
533             is invoked.  There will be 
534             <see cref="P:Mono.Options.Option.MaxValueCount" /> values if
535             <see cref="P:Mono.Options.Option.OptionValueType" /> is
536             <see cref="F:Mono.Options.OptionValueType.Required" />, but if
537             <see cref="P:Mono.Options.Option.OptionValueType" /> is
538             <see cref="F:Mono.Options.OptionValueType.Optional" /> then
539             <see cref="P:Mono.Options.OptionContext.OptionValues" /> may
540             contain fewer items.
541           </para>
542         </remarks>
543       </Docs>
544     </Member>
545     <Member MemberName="OnParseComplete">
546       <MemberSignature Language="C#" Value="protected abstract void OnParseComplete (Mono.Options.OptionContext c);" />
547       <MemberType>Method</MemberType>
548       <AssemblyInfo>
549         <AssemblyVersion>0.2.0.0</AssemblyVersion>
550         <AssemblyVersion>0.2.1.0</AssemblyVersion>
551       </AssemblyInfo>
552       <ReturnValue>
553         <ReturnType>System.Void</ReturnType>
554       </ReturnValue>
555       <Parameters>
556         <Parameter Name="c" Type="Mono.Options.OptionContext" />
557       </Parameters>
558       <Docs>
559         <param name="c">
560           An <see cref="T:Mono.Options.OptionContext" /> instance containing
561           information about the option that was parsed.
562         </param>
563         <summary>
564           Perform an action when an option is parsed.
565         </summary>
566         <remarks>
567           <para>
568             This method must be overridden by all subclasses, within which the
569             subclass can perform some custom per-option processing.
570           </para>
571           <para>
572             This method is invoked from within 
573             <see cref="M:Mono.Options.OptionSet.Parse(System.String,Mono.Options.OptionContext)" />
574             when an option with a name from
575             <see cref="M:Mono.Options.Option.GetNames" /> is encountered and
576             matches the required number of values governed by
577             <see cref="P:Mono.Options.Option.OptionValueType" /> and
578             <see cref="P:Mono.Options.Option.MaxValueCount" />.
579           </para>
580         </remarks>
581         <example>
582           <para>
583             The following example has a custom 
584             <see cref="T:Mono.Options.Option" /> subclass which overrides
585             <see cref="M:Mono.Options.Option.OnParseComplete(Mono.Options.OptionContext)" />:
586           </para>
587           <code lang="C#" src="examples/subclass.cs">// Case-Insensitive and Concatenating OptionSet
588 using System;
589 using System.Collections.Generic;
590 using Mono.Options;
591
592 class DemoOptionSet : OptionSet {
593         protected override void InsertItem (int index, Option item)
594         {
595                 if (item.Prototype.ToLower () != item.Prototype)
596                         throw new ArgumentException ("prototypes must be lower-case!");
597                 base.InsertItem (index, item);
598         }
599
600         protected override OptionContext CreateOptionContext ()
601         {
602                 return new OptionContext (this);
603         }
604
605         protected override bool Parse (string option, OptionContext c)
606         {
607                 string f, n, s, v;
608                 bool haveParts = GetOptionParts (option, out f, out n, out s, out v);
609                 Option nextOption = null;
610                 string newOption  = option;
611
612                 if (haveParts) {
613                         string nl = n.ToLower ();
614                         nextOption = Contains (nl) ? this [nl] : null;
615                         newOption = f + n.ToLower () + (v != null ? s + v : "");
616                 }
617
618                 if (c.Option != null) {
619                         // Prevent --a --b
620                         if (c.Option != null &amp;&amp; haveParts) {
621                                 if (nextOption == null) {
622                                         // ignore
623                                 }
624                                 else 
625                                         throw new OptionException (
626                                                 string.Format ("Found option `{0}' as value for option `{1}'.",
627                                                         option, c.OptionName), c.OptionName);
628                         }
629
630                         // have a option w/ required value; try to concat values.
631                         if (AppendValue (option, c)) {
632                                 if (!option.EndsWith ("\\") &amp;&amp; 
633                                                 c.Option.MaxValueCount == c.OptionValues.Count) {
634                                         c.Option.Invoke (c);
635                                 }
636                                 return true;
637                         }
638                         else
639                                 base.Parse (newOption, c);
640                 }
641
642                 if (!haveParts || v == null) {
643                         // Not an option; let base handle as a non-option argument.
644                         return base.Parse (newOption, c);
645                 }
646
647                 if (nextOption.OptionValueType != OptionValueType.None &amp;&amp; 
648                                 v.EndsWith ("\\")) {
649                         c.Option = nextOption;
650                         c.OptionValues.Add (v);
651                         c.OptionName = f + n;
652                         return true;
653                 }
654
655                 return base.Parse (newOption, c);
656         }
657
658         private bool AppendValue (string value, OptionContext c)
659         {
660                 bool added = false;
661                 string[] seps = c.Option.GetValueSeparators ();
662                 foreach (var o in seps.Length != 0
663                                 ? value.Split (seps, StringSplitOptions.None)
664                                 : new string[]{value}) {
665                         int idx = c.OptionValues.Count-1;
666                         if (idx == -1 || !c.OptionValues [idx].EndsWith ("\\")) {
667                                 c.OptionValues.Add (o);
668                                 added = true;
669                         }
670                         else {
671                                 c.OptionValues [idx] += value;
672                                 added = true;
673                         }
674                 }
675                 return added;
676         }
677 }
678
679 class Demo {
680         public static void Main (string[] args)
681         {
682                 List&lt;string&gt; names = new List&lt;string&gt; ();
683                 Dictionary&lt;string,string&gt; map = new Dictionary&lt;string,string&gt; ();
684                 int repeat = 1;
685
686                 OptionSet p = new DemoOptionSet () {
687                         { "n|name=",    v =&gt; names.Add (v) },
688                         { "r|repeat:",  (int v) =&gt; repeat = v },
689                         { "m|map=",     (k,v) =&gt; map.Add (k, v) },
690                 };
691
692                 List&lt;string&gt; extra;
693                 try {
694                         extra = p.Parse (args);
695                 }
696                 catch (OptionException e) {
697                         Console.Write ("subclass: ");
698                         Console.WriteLine (e.Message);
699                         return;
700                 }
701
702                 string message;
703                 if (extra.Count &gt; 0) {
704                         message = string.Join (" ", extra.ToArray ());
705                 }
706                 else {
707                         message = "Hello {0}!";
708                 }
709
710                 foreach (string name in names) {
711                         for (int i = 0; i &lt; repeat; ++i)
712                                 Console.WriteLine (message, name);
713                 }
714                 List&lt;string&gt; keys = new List&lt;string&gt;(map.Keys);
715                 keys.Sort ();
716                 foreach (string key in keys) {
717                         Console.WriteLine ("Key: {0}={1}", key, map [key]);
718                 }
719         }
720 }
721
722 </code>
723           <para>
724             See <see cref="T:Mono.Options.OptionSet" /> for more on this
725             example.
726           </para>
727         </example>
728         <altmember cref="M:Mono.Options.Option.Invoke(Mono.Options.OptionContext)" />
729       </Docs>
730     </Member>
731     <Member MemberName="OptionValueType">
732       <MemberSignature Language="C#" Value="public Mono.Options.OptionValueType OptionValueType { get; }" />
733       <MemberType>Property</MemberType>
734       <AssemblyInfo>
735         <AssemblyVersion>0.2.0.0</AssemblyVersion>
736         <AssemblyVersion>0.2.1.0</AssemblyVersion>
737       </AssemblyInfo>
738       <ReturnValue>
739         <ReturnType>Mono.Options.OptionValueType</ReturnType>
740       </ReturnValue>
741       <Docs>
742         <summary>
743           An <see cref="T:Mono.Options.OptionValueType" /> instance
744           specifying whether this <see cref="T:Mono.Options.Option" /> takes
745           a value, and if so, whether it's required or optional.
746         </summary>
747         <value>
748           An <see cref="T:Mono.Options.OptionValueType" /> specifying whether
749           a value is required for this value.
750         </value>
751         <remarks>
752           <para>
753             This is initialized based on the presence of <c>=</c> or
754             <c>:</c> within <see cref="P:Mono.Options.Option.Prototype" />.
755           </para>
756         </remarks>
757       </Docs>
758     </Member>
759     <Member MemberName="Parse&lt;T&gt;">
760       <MemberSignature Language="C#" Value="protected static T Parse&lt;T&gt; (string value, Mono.Options.OptionContext c);" />
761       <MemberType>Method</MemberType>
762       <AssemblyInfo>
763         <AssemblyVersion>0.2.0.0</AssemblyVersion>
764         <AssemblyVersion>0.2.1.0</AssemblyVersion>
765       </AssemblyInfo>
766       <ReturnValue>
767         <ReturnType>T</ReturnType>
768       </ReturnValue>
769       <Parameters>
770         <Parameter Name="value" Type="System.String" />
771         <Parameter Name="c" Type="Mono.Options.OptionContext" />
772       </Parameters>
773       <Docs>
774         <typeparam name="T">
775           The type to convert the string <paramref name="value" /> to.
776         </typeparam>
777         <param name="value">
778           A <see cref="T:System.String" /> containing a representation of the
779           type <typeparamref name="T" /> that should be converted into an
780           instance of type <typeparamref name="T" />.
781         </param>
782         <param name="c">
783           A <see cref="T:Mono.Options.OptionContext" /> containing additional
784           contextual information needed error handling.
785         </param>
786         <summary>
787           Converts the <see cref="T:System.String" /><paramref name="value" />
788           into an object of type <typeparamref name="T" />.
789         </summary>
790         <returns>
791           If <paramref name="value" /> is <see langword="null" />, then 
792           <see langword="default(T)" /> is returned.  Otherwise, 
793           <paramref name="value" /> is converted to a value of type 
794           <typeparamref name="T" />.
795         </returns>
796         <remarks>
797           <para>
798             <see cref="M:System.ComponentModel.TypeDescriptor.GetConverter" />
799             is used to get the 
800             <see cref="T:System.ComponentModel.TypeConverter" /> associated
801             with type <typeparamref name="T" />, and 
802             <see cref="M:System.ComponentModel.TypeConverter.ConvertFromString" />
803             is used to convert <paramref name="value" /> into a
804             <typeparamref name="T" />.
805           </para>
806         </remarks>
807         <exception cref="T:Mono.Options.OptionException">
808           If <paramref name="value" /> is not <see langword="null" /> and
809           <see cref="M:System.ComponentModel.TypeConverter.ConvertFromString" />
810           generated an exception while trying to convert 
811           <paramref name="value" />.
812         </exception>
813       </Docs>
814       <TypeParameters>
815         <TypeParameter Name="T" />
816       </TypeParameters>
817     </Member>
818     <Member MemberName="Prototype">
819       <MemberSignature Language="C#" Value="public string Prototype { get; }" />
820       <MemberType>Property</MemberType>
821       <AssemblyInfo>
822         <AssemblyVersion>0.2.0.0</AssemblyVersion>
823         <AssemblyVersion>0.2.1.0</AssemblyVersion>
824       </AssemblyInfo>
825       <ReturnValue>
826         <ReturnType>System.String</ReturnType>
827       </ReturnValue>
828       <Docs>
829         <summary>
830           The <see cref="T:Mono.Options.Option" /> prototype, containing
831           option name aliases and the option value requirements.
832         </summary>
833         <value>
834           A <see cref="T:System.String" /> containing the prototype of this
835           <see cref="T:Mono.Options.Option" /> instance.
836         </value>
837         <remarks>
838           <para>
839             The prototype contains a <c>|</c>-separated list of all option name
840             aliases and a value specifier of <c>=</c> for required values and
841             <c>:</c> for optional values; if neither <c>=</c> nor <c>:</c> is
842             present, no value is taken.
843           </para>
844           <para>
845             If a value specifier is present, then a value separator list may
846             also be present after the value specifier.
847           </para>
848         </remarks>
849       </Docs>
850     </Member>
851     <Member MemberName="ToString">
852       <MemberSignature Language="C#" Value="public override string ToString ();" />
853       <MemberType>Method</MemberType>
854       <AssemblyInfo>
855         <AssemblyVersion>0.2.0.0</AssemblyVersion>
856         <AssemblyVersion>0.2.1.0</AssemblyVersion>
857       </AssemblyInfo>
858       <ReturnValue>
859         <ReturnType>System.String</ReturnType>
860       </ReturnValue>
861       <Parameters />
862       <Docs>
863         <summary>
864           Returns <see cref="P:Mono.Options.Option.Prototype" />.
865         </summary>
866         <returns>
867           A <see cref="T:System.String" /> containing
868           <see cref="P:Mono.Options.Option.Prototype" />.
869         </returns>
870         <remarks>
871         </remarks>
872       </Docs>
873     </Member>
874   </Members>
875 </Type>