【发布时间】:2011-08-08 09:46:41
【问题描述】:
我尝试在我们产品的几个程序集上运行 FxCop,我得到了很多匹配“指定 IFormatProvider”规则。
碰巧,其中一些是合法的,但它也匹配这样的代码:
Logger.DebugFormat("Appending file {0}", fileName);
可以写成
Logger.DebugFormat(CultureInfo.InvariantCulture, "Appending file {0}", fileName);
第二种变体更难阅读。
那么,实际上是否建议始终指定 IFormatProvider 还是“只是”规则中使用的启发式的限制?
【问题讨论】:
标签: .net fxcop iformatprovider