You can introduce a variable when using the 'is' operator:
if (a is Circle s) Console.WriteLine (s.Radius);
This is equivalent to:
Circle s; if (a is Circle) { s = (Circle) a; Console.WriteLine (s.Radius); }
The pattern variable introduced is available in the current scope, so the following is legal:
if (a is Circle s && s.Radius > 100000) Console.WriteLine ("Big");
And it remains in scope outside the is-expression, allowing this:
if (a is Circle s && s.Radius > 100000){ Console.WriteLine ("Big"); } else{ s = new Circle(); // s is in scope } Console.WriteLine (s.Radius); // Still in scope