In C # 7.0, var-templates appeared which, judging by the documentation, are always true and are needed to create a new variable with the same type and value.
Threw a test method, the piece really works.
private void TestPattern(object k) { if (k is var test) Console.WriteLine("Result: " + test.GetType() + " " + test); Console.ReadKey(); } However, I find it absolutely meaningless. Moreover, the code is terribly unreadable and not obvious to me.
So for what situations do you actually need this template?