namespace MyNameSpace
{
static class MyClass
{
static MyClass()
{
//Authentication process.. User needs to enter password
According to the MSDN, a static constructor:
A static constructor is called automatically to initialize the class before the first instance is created or any static members are referenced.
So the static constructor will be called before the static method MyClass.MyMethod()
is invoked (assuming not also invoked during static construction or static field initialization of course).
Now, if you are doing anything asynchronous in that static constructor
, then it's your job to synchronize that.