本文整理汇总了C#中Options.PrintUsage方法的典型用法代码示例。如果您正苦于以下问题:C# Options.PrintUsage方法的具体用法?C# Options.PrintUsage怎么用?C# Options.PrintUsage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options
的用法示例。
在下文中一共展示了Options.PrintUsage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
//this is the driver method that I am using to test the options class as it is being written, needs to be replaced with a good unit test suite
public static void Main (string[] args)
{
var opt = new Option(new []{"h","talk"},()=>Console.WriteLine("hello world"),"Prints greeting");
var opt2 = new Option(new []{"a","add3"},(int i)=>Console.WriteLine(i+3),"value","Adds 3 to value");
var opt3 = new Option(new []{"x","so","dsdsdsajdlasdsjkdjask","ThisIsAnotherOne","YetAnotherOne","ItGoesOn", "d"},()=>Console.WriteLine("Goodbye World"),"This is a test of word wrapping if everything goes ok this shoudl wrap around on to several lines while maintaining an offset for other text. If this is not wrapped correctly something is wrong...very wrong.");
Options opts = new Options("This is not the real options for this command so do not try them.")
{
opt,
opt2,
new Option((string x) => Console.WriteLine(x),"hostname","The hostname of the server"),
opt3,
};
opts.PrintUsage();
opt.Invoke("h",null);
opt2.Invoke("a","10000");
opts.Parse(new []{"--h","--add3","6"});
opts.Parse(new []{"-ha","7"});
opts.Parse(new []{"-a","this is fail"});
Console.ReadLine();
}
示例2: PrintUsage
static void PrintUsage(Options opts)
{
var v = typeof(Program).Assembly.GetName().Version;
Console.WriteLine("Managed Extensibility Framework Explorer Version {0}", v);
Console.WriteLine("Copyright (c) 2009 Microsoft Corporation. All rights reserved.");
Console.WriteLine();
Console.WriteLine("Built for: {0}", typeof(Export).Assembly);
Console.WriteLine();
Console.WriteLine("Usage: mefx.exe [assembly files and directories] [action] {options}");
Console.WriteLine();
Console.WriteLine("Example: mefx.exe /file:MyAssembly.dll /causes /verbose");
Console.WriteLine();
Console.WriteLine("Switches:");
Console.WriteLine();
opts.PrintUsage(Console.Out);
}