2010-04-07 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / gtest-anon-7.cs
blob4a27f625a1e2961612f24dc36d1e87beb5287df5
1 using System;
2 using System.Collections.Generic;
4 class MyDisposable : IDisposable
6 static int next_id;
7 int id = ++next_id;
9 public void Dispose ()
10 { }
12 public int ID {
13 get { return id; }
16 public override string ToString ()
18 return String.Format ("{0} ({1})", GetType (), id);
22 class X
24 public static IEnumerable<int> Test (int a)
26 MyDisposable d;
27 using (d = new MyDisposable ()) {
28 yield return a;
29 yield return d.ID;
33 static void Main ()
35 foreach (int a in Test (5))
36 Console.WriteLine (a);