Skip to content
gsscoder edited this page Jan 25, 2013 · 15 revisions

Strict Parsing

If your application can not recover after a failed parsing, entrust strict parsing.

var options = new Options();
// Parse in 'strict mode', success or quit
if (CommandLineParser.Default.ParseArgumentsStrict(args, options))
{
  // Domain logic here
}

This feature is available from Version 1.9.4.107 beta as stated here.

Map heterogeneous values correctly

Before Version 1.9.4.201 beta all options non mapped with a short or long name could have been read with ValueListAttribute. If values are of different type and you will handle these individually, embrace ValueOptionAttribute.

class Options
{
  [ValueOption]
  public uint Count { get; set; }

  [ValueOption]
  public double? Size { get; set; }

  [ValueOption]
  public string Content { get; set; }
}