C# 7.0 brings many syntax improvements and features. One of the most valuable is the new pattern matching syntax. Usually it's used with switch
blocks but it has another great use with if
conditions. Currently there are no auto-replacement or auto-suggestion for that case in ReSharper yet (at current version 2017.1 EAP 2), but we could easily add it. But first let's consider the problem and improvements C# 7.0 brings us.
For example, consider this code:
if (obj is FooType)
{
var fooObj = (FooType)obj;