Use pattern matching
This refactoring applies to:
What: Use pattern matching.
When: You want to use the new C# pattern matching capabilities.
Why: This refactoring will make your code more clear and concise.
Place your caret inside the statement.
Press Ctrl+. to trigger the Quick Actions and Refactorings menu.
Select Use pattern matching.