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

47 lines
506 B
C#

using System;
using System.Threading.Tasks;
class A
{
public Task<int> GetValue (int b)
{
return Task.FromResult (b);
}
}
class C
{
public static int Main ()
{
var c = new C ();
return c.Foo ().Result;
}
public A Instance {
get {
return new A ();
}
}
async Task<int> Foo ()
{
int value = 1;
{
int b = 3;
await Test (value,
async () => {
await Instance.GetValue (b);
});
}
return 0;
}
T Test<T> (int arg, Func<T> func)
{
return func ();
}
}