本文整理汇总了C#中System.CommandLine.WriteUsage方法的典型用法代码示例。如果您正苦于以下问题:C# CommandLine.WriteUsage方法的具体用法?C# CommandLine.WriteUsage怎么用?C# CommandLine.WriteUsage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.CommandLine
的用法示例。
在下文中一共展示了CommandLine.WriteUsage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
try
{
// Parse command line arguments
s_commandLine = new CommandLine(args);
if (!s_commandLine.IsValid)
{
s_commandLine.WriteUsage();
return;
}
// Get Shard Map Manager
ShardMapManager smm = ShardMapManagerFactory.GetSqlShardMapManager(
GetConnectionString(), ShardMapManagerLoadPolicy.Eager);
Console.WriteLine("Connected to Shard Map Manager");
// Get Shard Map
ShardMap map = smm.GetShardMap(s_commandLine.ShardMap);
Console.WriteLine("Found {0} shards", map.GetShards().Count());
// Create connection string for MultiShardConnection
string connectionString = GetCredentialsConnectionString();
// REPL
Console.WriteLine();
while (true)
{
// Read command from console
string commandText = GetCommand();
if (commandText == null)
{
// Exit requested
break;
}
// Evaluate command
string output;
using (MultiShardConnection conn = new MultiShardConnection(map.GetShards(), connectionString))
{
output = ExecuteCommand(conn, commandText);
}
// Print output
Console.WriteLine(output);
}
}
catch (Exception e)
{
// Print exception and exit
Console.WriteLine(e);
return;
}
}