I need to call a async
method from my Form1
constructor. Since a constructor can't have a return type, I can't add a async void
. I read that static constructor can be async
but I need to call methods from constructor that aren't static
, such as InitializeComponent()
(since it's the Form's constructor).
The class is:
public partial class Form1 : Form
{
InitializeComponent();
//some stuff
await myMethod();
}
I read this one too but I still don't know how to implement this (in my case) since the method still requires to use async
.