Code inspection: Suspicious type conversion or check
Last modified: 29 May 2024tip
This inspection reports type checks that never succeed because there are no inheritance or implementation relationships between the type of the object and the type it is tested against.
Unlike the compiler warning CS0184, which only detects situations where the object type is not directly derived from the tested type, this inspection detects a wider range of suspicious checks, taking into account all possible inheritance chains in your solution.
Heere is an example that illustrates the issue in a simple case: