Resharper 抱怨下面的代码,说最后的空检查是多余的,因为“表达式总是假的”:
ICloneable data = item as ICloneable;
if (data == null)
throw new InvalidCastException("blah blah, some error message");
object copy = data.Clone();
if (copy == null) // <-- this is where it complains.
return default(T);
它怎么知道它永远不能为空?