Suppose I have a bunch of static fields and I want to use them in switch:
public static string PID_1 = \"12\"; public static string PID_2 = \"13\"; public st
I know this is an old question but there is a way that wasnt covered in the other answers that doesnt involve changing the approach:
switch(pid) { case var _ when pid == PID_1: //Do something 1 break; }