该代码中的错误警告:
return (Patient as IHrsHolder) ?? (Course as IHrsHolder) ?? Appointment;
我想抑制警告,所以我需要错误号码。但错误列表或输出中没有任何数字,只有:
CodeContracts: warning: The Boolean condition this.Patient == null always evaluates to a constant value. If it (or its negation) appear in the source code, you may have some dead code or redundant check
如何抑制(不重写代码)?
答案 0 :(得分:0)
在这种情况下,“ErrorNumber”实际上是一个字符串:
[SuppressMessage("Microsoft.Contracts", "TestAlwaysEvaluatingToAConstant")]