Code inspection: Redundant nullable warning suppression expression
Last modified: 27 May 2024tip
This inspection reports null-suppression operators !
on objects that are heuristically not nullable.
Although the redundant !
operator will not influence your code in any way, it may deteriorate readability as it makes non-nullable objects look as though they are nullable.
In the example below, the one
parameter is nullable and we can use the !
operator on it, but the variable two
initialized with the one!
expression is not nullable and therefore using !
on it does not make any sense: