Answers for "multi case in c#"

C#
0

multi case in c#

switch (value)
{
   case var s when new[] { 1,2,3 }.Contains(s):
      // Do something
      break;
   case var s when new[] { 4,5,6 }.Contains(s):
      // Do something
      break;
   default:
      // Do the default
      break;
}
Posted by: Guest on October-30-2020

C# Answers by Framework

Browse Popular Code Answers by Language