Check if object is NOT of type (!= equivalent for "IS") - C#
This is one way:
if (!(sender is TextBox)) {...}
Couldn't you also do the more verbose "old" way, before the is
keyword:
if (sender.GetType() != typeof(TextBox)) { // ... }
C# 9 allows using the not operator. You can just use
if (sender is not TextBox) {...}
instead of
if (!(sender is TextBox)) {...}