File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,43 @@ You can utilize the parser library in several ways:
46
46
1 . Create a class to define valid options, and to receive the parsed options.
47
47
2 . Call ParseArguments with the args string array.
48
48
49
+ C# Quick Start:
50
+
51
+ ``` csharp
52
+ using System ;
53
+ using CommandLine ;
54
+
55
+ namespace QuickStart
56
+ {
57
+ class Program
58
+ {
59
+ public class Options
60
+ {
61
+ [Option ('v' , " verbose" , Required = false , HelpText = " Set output to verbose messages." )]
62
+ public bool Verbose { get ; set ; }
63
+ }
64
+
65
+ static void Main (string [] args )
66
+ {
67
+ Parser .Default .ParseArguments <Options >(args )
68
+ .WithParsed <Options >(o =>
69
+ {
70
+ if (o .Verbose )
71
+ {
72
+ Console .WriteLine ($" Verbose output has been enabled. Current Arguments: -v {o .Verbose }" );
73
+ Console .WriteLine (" Quick Start Example! App is in Verbose mode so verbose messages will be shown!" );
74
+ }
75
+ else
76
+ {
77
+ Console .WriteLine ($" Current Arguments: -v {o .Verbose }" );
78
+ Console .WriteLine (" Quick Start Example!" );
79
+ }
80
+ });
81
+ }
82
+ }
83
+ }
84
+ ```
85
+
49
86
C# Examples:
50
87
51
88
``` csharp
You can’t perform that action at this time.
0 commit comments