Tuesday, June 16, 2009

Components I use: NConsoler

Need an equivalent to boost program_options in c#?
Here you go; NConsoler provides an AOP approach on command line parsing.

Code looks like this:

using System;
using NConsoler;

public class Program {
    public static void Main(params string[] args) {
        Consolery.Run(typeof(Program), args);
    }

    [Action]
    public static void Method(
        [Required] string name,
        [Optional(true)] bool flag) {
        Console.WriteLine("name: {0}, flag: {1}", name, flag);
    }
}

Rating: Great!

No comments:

Post a Comment