Skip to content

Commit fa183ca

Browse files
authored
Update README.md (#61)
Add an example for how to use enums
1 parent f6848c8 commit fa183ca

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,21 @@ You can ask for the long version of the help by using the `HelpFormat.Full` spec
7070
Parser.DisplayHelp<Options>(HelpFormat.Full);
7171
```
7272

73+
### Specifying multiple enum values
74+
75+
If you have an enum defined as a flags enum, you need to pass this value as an argument in order for it to be correctly parsed: `"A, B"` or `A,B`.
76+
```csharp
77+
[Flags]
78+
enum MyFlags
79+
{
80+
A = 1,
81+
B = 2
82+
}
83+
```
84+
Note:
85+
- The enum values need to be starting at 1, otherwise when the OR operation happens, the value that is 0 will be lost
86+
- The string needs to either be inside a double quote (if it contains a space) or have no space inside
87+
7388
## Types of arguments
7489

7590
To use you need to provide a class that is going to hold the options parsed from the command line and use attributes to define the behavior of the parser.

0 commit comments

Comments
 (0)