c# quick "is" "as"

C#
if (randomObject is TargetType tt)
{
    // Use tt here
}
Source

Also in C#: