Menu

#3 Suggestions for .NET 2.0 version

open
nobody
None
5
2007-10-08
2007-10-08
Anonymous
No

Some suggestions for the a .NET 2.0 version:

public static T GetOptions<T>() where T : new()
{
return GetOptions<T>(System.Environment.CommandLine);
}

public static T GetOptions<T>(string commandLine) where T : new()
{
return GetOptions<T>(commandLine, true);
}

public static T GetOptions<T>(string commandLine, bool includesProgramName) where T : new()
{
T result = new T();

CommandLineParser parser = new CommandLineParser(result);
parser.Parse(commandLine, includesProgramName);

return result;
}

public static string GetCommandLine()
{
return System.Environment.CommandLine;
}

public static string GetUsage<T>() where T : new()
{
T result = new T();

CommandLineParser parser = new CommandLineParser(result);
parser.Parse(System.Environment.CommandLine, true);

return parser.Usage;
}

public static string GetExplicitOptions<T>() where T : new()
{
T result = new T();

CommandLineParser parser = new CommandLineParser(result);
parser.Parse(System.Environment.CommandLine, true);

return parser.ExplicitOptions;
}

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.