[metadata] Fix leaks when handling a few attributes (#16675)
[mono-project.git] / mcs / tests / test-pattern-12.cs
blob19f39f190b4f86d85ece196c52311a90f6c2e971
1 using System;
2 using System.Collections.Generic;
4 class X
6 public static int Main ()
8 foreach (var x in Test1 ("2"))
10 Console.WriteLine (x);
11 return 1;
14 foreach (var x in Test2 (2))
16 Console.WriteLine (x);
17 return 2;
20 return 0;
23 public static IEnumerable<object> Test1 (object expr)
25 if (expr is short list)
27 yield return "list.Length";
31 public static IEnumerable<object> Test2 (object expr)
33 if (expr is string list)
35 yield return "list.Length";