'C# Pattern match arrays

var x = new int[] { 1, 2 };
var y = x switch {
  { 1, 2 } => "yea",
  _ => "nay"
};

fails to compile.

How can I pattern-match arrays?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source