I have this code:
Assert.IsTrue(datasetMetadata1 != null && datasetMetadata1.Length == 5);
Assert.IsTrue(datasetMetadata2 != null && datasetMetadata2 .Length == 11);
if ((datasetMetadata1 == null || datasetMetadata1.Length != 5) ||
(datasetMetadata2 == null || datasetMetadata2 .Length != 11)
{
/* do something */
}
which ReSharper simplifies by removing the redundant (because allways true
) expression == null
and by inverting the if
-statement to something similar to:
if ((datasetMetadataPunktort.Length == 5) && (datasetMetadataFlurstueck.Length == 11))
return
However for me it seems even this check is meaningless and can easily be omited as the condition is allways true. So I wonder why ReSharper detects the obsolete check against null
but not for the rest.
Am I missing any case where the check fails?