Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / test-pattern-09.cs
1 using System.Collections.Generic;
2
3 class Expr
4 {
5         public int Field;
6 }
7
8 static class X
9 {
10         public static IEnumerable<int> Test (Expr expr)
11         {
12                 object exprCur = expr;
13                 if (exprCur is Expr list) {
14                         yield return list.Field;
15                 }
16         }
17
18         public static IEnumerable<string> Test2 (int? expr)
19         {
20                 int? exprCur = expr;
21                 while (exprCur != null) {
22                         if (exprCur is int list) {
23                                 yield return list.ToString ();
24                         }
25                 }
26         }       
27
28         public static void Main ()
29         {
30                 Test (null);
31                 Test2 (3);
32         }
33 }