In winform, Threre is a button and when i click for clickevent, Code is stopped on await Task.Delay(2000)
Full code is below
public Form1()
{
InitializeComponent();
this.button1.Click += new EventHandler( start3 );
}
Func<Task<int>> ftask1 => async () =>
{
Console.WriteLine( "start" );
await Task.Delay( 2000 );
Console.WriteLine( "done" );
return 1;
};
public void start3( object o , EventArgs e )
{
var result = ftask1().Result;
}`
on await Task.Delay( 2000 ); from ftask1, task is not compeleted.
What is the problem of this?