using System;
public class Program
{
public static void Main()
// Instantiate type
var type = new TypeOne()
Id = 7
};
// Pass type into switch statement
switch (type)
case var switchedType when type is TypeTwo:
Console.WriteLine("The type is type two");
break;
default:
Console.WriteLine("No type found");
}
public class TypeOne
public int Id { get; set; }
public class TypeTwo