Parsing console application arguments In our console app, the parsing of application arguments is done like so:

using System.Linq;

namespace Generator
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var param1 = args.SingleOrDefault(arg =&gt; arg.StartsWith("p1:"));
            if (!string.IsNullOrEmpty(param1))
            {
                param1  = param1.Replace("p1:", "");
            }
            //...
        }
    }
}


It's supposed to be called like this:


`Generator.exe p1:somevalue`



Is there a better/simpler way to parse arguments?
I'd recommend taking advantage of the excellent Mono.Options module.  It's a single .cs file you can drop in to your solution and get full-featured parsing of GNU getopt-style command lines.  (Things like -x -y -z, which is equivalent to -xyz, or -k value, or --long-opt, and so forth.)