Initial set of Ward sgen annotations (#5705)
[mono.git] / mcs / tests / test-anon-107.cs
1 using System;
2 using System.Collections.Generic;
3
4 class MyDisposable : IDisposable
5 {
6         static int next_id;
7         int id = ++next_id;
8
9         public void Dispose ()
10         { }
11
12         public int ID {
13                 get { return id; }
14         }
15
16         public override string ToString ()
17         {
18                 return String.Format ("{0} ({1})", GetType (), id);
19         }
20 }
21
22 class X
23 {
24         public static IEnumerable<int> Test (int a)
25         {
26                 MyDisposable d;
27                 using (d = new MyDisposable ()) {
28                         yield return a;
29                         yield return d.ID;
30                 }
31         }
32
33         public static void Main ()
34         {
35                 foreach (int a in Test (5))
36                         Console.WriteLine (a);
37         }
38 }