[tuner] handle the case with multiple "preserve" attributes
[mono-project.git] / mcs / tests / test-async-77.cs
blob5f4559a781cd5627b223d2ad30f7f5439e5dcaa3
1 using System;
2 using System.Threading.Tasks;
4 public class Class1
6 protected void InvokeAction (Action action)
8 action ();
11 public void Bar()
15 async Task Test ()
17 Task.Run(async () =>
19 var implementor = ServiceLocator.GetImplementor<IInterface1> ();
20 string message = null;
21 bool result = await implementor.Foo ((s) => message = s);
23 InvokeAction (() => Bar ());
24 }).Wait ();
27 interface IInterface1
29 Task<bool> Foo(Action<string> action);
32 class CIInterface1 : IInterface1
34 public Task<bool> Foo (Action<string> action)
36 action ("msg");
37 return Task.FromResult (false);
41 static class ServiceLocator
43 public static TService GetImplementor<TService>() where TService : class
45 return (TService) (object) new CIInterface1 ();
49 public static void Main ()
51 new Class1 ().Test ().Wait ();