We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 98e125f commit e6b4055Copy full SHA for e6b4055
csharp/ql/test/library-tests/csharp11/ListPattern.cs
@@ -0,0 +1,38 @@
1
+using System.Collections.Generic;
2
+
3
+class ListPattern
4
+{
5
+ public void M1(int[] x)
6
+ {
7
+ if (x is []) { }
8
+ if (x is [1]) { }
9
+ if (x is [_, 2]) { }
10
+ if (x is [var y, 3, 4]) { }
11
+ if (x is [5 or 6, _, 7]) { }
12
+ if (x is [var a, .., 2]) { }
13
+ if (x is [var b, .. { Length: 2 or 5 }, 2]) { }
14
+ }
15
16
+ public void M2(string[] x)
17
18
+ switch (x)
19
20
+ case []:
21
+ break;
22
+ case ["A"]:
23
24
+ case [_, "B"]:
25
26
+ case [var y, "C", "D"]:
27
28
+ case ["E" or "F", _, "G"]:
29
30
+ case [var a, .., "H"]:
31
32
+ case [var b, .. var c, "I"]:
33
34
+ default:
35
36
37
38
+}
0 commit comments