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 => 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?