Resharper complains about the following code, stating that the last zero check is redundant because the expression is always false:
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);
How does he know that he can never be null?
source
share