- Notifications
You must be signed in to change notification settings - Fork 286
Advanced Topics
IMPORTANT NOTE: This wiki refers to latest stables, if a beta version is available in github master branch please refer to Latest Version.
The parser is culture-aware. The args[] array passed to ParseArguments<T>(...) is a string array, so when the parser loads data into target instance every string undergoes a conversion.
Now suppose you define a target class like this:
classOptions{[Option('v',"value")]publicdoubleSomeValue{get;set;}}If your system use a dot as decimal separator and you type the following command line:
$ app -v 10,4 the parsing process will fail.
If you want that parsing occurs with a particular culture, just set desired CultureInfo in settings instance.
varparser=newCommandLine.Parser(with =>with.ParsingCulture=newCultureInfo("it-IT"));Please note that default behavior can change in future versions, so I suggest you to always explicit your culture preference.
Remarks: CommandLine.Parser.Default default singleton uses CultureInfo.InvariantCulture.