"Exception Filters"

static void Test() {
	try {
		SomeOperation();
	}
	catch (Exception e) when (e.InnerException is OperationCanceledException oce) {
		Console.WriteLine($"Operation was cancelled: {oce}");
	}
}


Code snippet taken from "Two Decades of C#: A Reference - C# 5 and C# 6".