小编Gre*_*oev的帖子

通过C#关键字典获取价值

我有这本字典。

private Dictionary<string[], ICommand> commandsWithAttributes = new Dictionary<string[], ICommand>();
Run Code Online (Sandbox Code Playgroud)

我需要commandsWithAttributes按部分键查找元素。我的意思是:

"-?" -是我用来查找商品的钥匙。

({"-t","--thread"},ICommand)

({"-?","--help"},ICommand) <-这是我需要找到的。

c# dictionary

3
推荐指数
1
解决办法
87
查看次数

如何在 Perl 中创建和抛出异常?

例如,php 有类似 InvalidArgumentException 的异常,带有自定义消息“未找到当前组”。

我可以在代码中抛出这个异常。

if ($groupId === 0) {
    throw new InvalidArgumentException('Current group not found');
}
Run Code Online (Sandbox Code Playgroud)

我可以继承这个异常并创建另一个子异常。

Perl 中的异常是如何工作的?

perl exception

3
推荐指数
1
解决办法
166
查看次数

标签 统计

c# ×1

dictionary ×1

exception ×1

perl ×1