Hi,
I'm looking for a getopt library for c#. So far I found a few (phpguru, XGetOptCS, getoptfordotnet) but these look more like unfinished attempts that only support a part of C's getopt. Is there a full getopt c# implementation?
Hi,
I'm looking for a getopt library for c#. So far I found a few (phpguru, XGetOptCS, getoptfordotnet) but these look more like unfinished attempts that only support a part of C's getopt. Is there a full getopt c# implementation?
I've a project which will need this sort of thing eventually too. I was wondering whether PowerShell exposed any of its argument processing in a nice way... might be worth a look.
Are you really after "getopt for C#" or do you want an idiomatic, nice to work with argument parser for .NET? I would imagine a decent argument parser in .NET may well take advantage of things which couldn't be in getopt, such as declarative flags via attributes.
The Mono Project has (or rather had) one based on attributes, but last I checked it was marked as obsolete. But since it's open source, you might be able to pull the code out and use it yourself.
Here is a .NET Implementation of getopt: http://www.codeplex.com/getopt
For posterity:
CommandParser is another one with a BSD license
Miguel de Icaza raves about Mono.Options. It is just a single C# source file, so you can just include it in your project without introducing any new dependencies.