linux-packaging-mono/mcs/tests/test-anon-107.cs
Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

39 lines
551 B
C#

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;
}
}
public static void Main ()
{
foreach (int a in Test (5))
Console.WriteLine (a);
}
}