本文整理汇总了C#中ParameterList.WithValue方法的典型用法代码示例。如果您正苦于以下问题:C# ParameterList.WithValue方法的具体用法?C# ParameterList.WithValue怎么用?C# ParameterList.WithValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterList
的用法示例。
在下文中一共展示了ParameterList.WithValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
var inputFile = new Parameter<FileInfo>
{
ShortName = "i",
LongName = "input",
ValueName = "filename",
Description = "The path of the input file.",
};
var outputFile = new Parameter<FileInfo>()
{
ShortName = "o",
LongName = "output",
ValueName = "filename",
Description = "The path of the output file.",
};
var playingOption = new Parameter<PlayingOption>()
{
ShortName = "p",
LongName = "playing-option",
Description = "The options for playing.",
};
var randomNumbers = new ParameterList<double>
{
ShortName = "r",
LongName = "random",
Description = "Random numbers.",
};
var fast = new Parameter<bool>
{
ShortName = "f",
LongName = "fast",
Description = "Make it fast.",
};
var culture = new Parameter<CultureInfo>
{
ShortName = "cu",
LongName = "culture",
Description = "The culture.",
IsOptional = true,
DefaultValue = CultureInfo.InvariantCulture
};
var count = new Parameter<int>()
{
ShortName = "c",
LongName = "count",
Description = "Count of something.",
IsOptional = true,
DefaultValue = 1,
PossibleValues = { 1, 2, 3, 4, 5 },
StaticContextParameters =
{
randomNumbers
}
};
var commandLine = new CommandLine
{
ProgramName = "sarcasmizer",
Description = "This is a good program.",
Parameters =
{
inputFile,
outputFile,
playingOption,
count,
fast,
culture
},
Examples =
{
new Example
{
Parameters =
{
inputFile.WithValue(new FileInfo("foo.txt")),
outputFile.WithValue(new FileInfo("bar.txt"))
},
Description = "Simple example."
},
new Example
{
Parameters =
{
inputFile.WithValue(new FileInfo("foo.txt")),
outputFile.WithValue(new FileInfo("bar.txt")),
count.WithValue(8)
},
Description = "Example."
},
new Example
//.........这里部分代码省略.........