本文整理汇总了C#中CommandParameters.Get方法的典型用法代码示例。如果您正苦于以下问题:C# CommandParameters.Get方法的具体用法?C# CommandParameters.Get怎么用?C# CommandParameters.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandParameters
的用法示例。
在下文中一共展示了CommandParameters.Get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CommandMain
public static void CommandMain(CommandParameters parameters, ICommandExecutor executor)
{
var targets = from Character c in executor.Server.Characters where c.Name == parameters.Get<string>(0) select c;
if (targets.Count() == 0)
throw new Exception("Target not found");
Character target = targets.First<Character>();
String title = parameters.Get<String>(1, "");
target.Title = title;
}
示例2: CommandMain
public static void CommandMain(CommandParameters parameters, ICommandExecutor executor)
{
var targets = from Character c in executor.Server.Characters where c.Name == parameters.Get<String>(0) select c;
if (targets.Count() == 0)
throw new Exception("Target not found");
Character target = targets.First<Character>();
AdminLevel level = (AdminLevel)parameters.Get<int>(1);
if (!Enum.IsDefined(typeof(AdminLevel), level))
throw new Exception(String.Format("Admin level out of range ({0})", (int)level));
target.Admin = level;
}