2 using System.Threading.Tasks;
3 using System.Threading;
4 using System.Collections;
5 using System.Collections.Generic;
9 int Value { get; set; }
14 public S (int a1, string a2)
20 public int Value { get; set; }
22 public void SetValue (int value)
28 struct S2 : IEnumerable
30 public List<int> Values;
32 public void Add (int x)
35 Values = new List<int> ();
40 public IEnumerator GetEnumerator()
42 return Values as IEnumerator;
48 async Task<T> NewInitTestGen<T> () where T : struct, IFoo
51 Value = await Task.Factory.StartNew (() => 13).ConfigureAwait (false)
60 static async Task<int> NewInitCol ()
63 await Task.FromResult (1),
64 await Task.Factory.StartNew (() => 2)
67 return s.Values [0] + s.Values [1];
70 public static int Main ()
72 var t = new Tester().NewInitTestGen<S> ();
74 if (!Task.WaitAll (new[] { t }, 1000)) {
78 if (t.Result.Value != 13)
81 var v = NewInitCol ().Result;