Check if object is NOT of type (!= equivalent for "IS") - C#
Solution 1:
This is one way:
if (!(sender is TextBox)) {...}
Solution 2:
C# 9 allows using the not operator. You can just use
if (sender is not TextBox) {...}
instead of
if (!(sender is TextBox)) {...}