remove NotWorking
[mcs.git] / tests / gtest-iter-11.cs
blob7ec5010916e92774e99fe74f24557db996223acf
1 using System;
2 using System.Collections;
3 using System.Collections.Generic;
5 class Foo {}
7 class Bar : Foo {
8 public string Name { get; set; }
11 class Collection<T> : IEnumerable<T> where T : Foo {
12 List<T> list = new List<T> ();
14 public void Add (T t)
16 list.Add (t);
19 public IEnumerator<T> GetEnumerator ()
21 foreach (T t in list)
22 yield return t;
25 IEnumerator IEnumerable.GetEnumerator ()
27 return GetEnumerator ();
31 class BarCollection : Collection<Bar> {}
33 class Program {
35 static int Main ()
37 var collection = new BarCollection () {
38 new Bar { Name = "a" },
39 new Bar { Name = "b" },
40 new Bar { Name = "c" },
43 foreach (var bar in collection)
44 Console.WriteLine (bar.Name);
46 return 0;