Author: martin
Date: 2006-09-12 08:30:54 -0400 (Tue, 12 Sep 2006)
New Revision: 65299

Added:
   branches/martin/anonymous-methods/work/test-martin-26.cs
Log:
New test.

Added: branches/martin/anonymous-methods/work/test-martin-26.cs
===================================================================
--- branches/martin/anonymous-methods/work/test-martin-26.cs    2006-09-12 
12:25:03 UTC (rev 65298)
+++ branches/martin/anonymous-methods/work/test-martin-26.cs    2006-09-12 
12:30:54 UTC (rev 65299)
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+
+class MyDisposable : IDisposable
+{
+       static int next_id;
+       int id = ++next_id;
+
+       public void Dispose ()
+       { }
+
+       public int ID {
+               get { return id; }
+       }
+
+       public override string ToString ()
+       {
+               return String.Format ("{0} ({1})", GetType (), id);
+       }
+}
+
+class X
+{
+       public static IEnumerable<int> Test (int a)
+       {
+               MyDisposable d;
+               using (d = new MyDisposable ()) {
+                       yield return a;
+                       yield return d.ID;
+               }
+       }
+
+       static void Main ()
+       {
+               foreach (int a in Test (5))
+                       Console.WriteLine (a);
+       }
+}

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to