-
Notifications
You must be signed in to change notification settings - Fork 293
Advanced Topics
gsscoder edited this page Jun 1, 2012
·
12 revisions
The parser is culture-aware. The args[] array passed to ParseArguments is a string array, so when the parser loads data into target instance every string undergoes a conversion.
The conversion subdues to current thread culture.
Now suppose you define a target class like this:
class Options {
[Option("v", "value")]
public double SomeValue { 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 before calling ParseArguments:
Thread.CurrentThread.CurrentCulture = new CultureInfo("it-IT");
[TO BE CONTINUED...]