首页 新闻 会员 周边

Contract.ContractFailed 不起作用

0
悬赏园豆:20 [已关闭问题] 关闭于 2011-10-31 18:41

如题,以下代码中 Console.WriteLine 不执行,不会有输出:

class Program {
static void Main(string[] args) {
Contract.ContractFailed += (sender, e) => {
e.SetUnwind();
Console.WriteLine(e.FailureKind.ToString() + ":" + e.Message);
};
Contract.Requires(args.Length > 0, "必须有参数");
}
}

谢谢!

dotnet4的主页 dotnet4 | 初学一级 | 园豆:16
提问于:2011-09-22 09:56
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册