namespace MyNameSpace
{
static class MyClass
{
static MyClass()
{
//Authentication process.. User needs to enter password
From the documentation (emphasis mine):
A static constructor is called automatically to initialize the class before the first instance is created or any static members are referenced.
Or you could step through in the debugger.
Here's the actual order in which things go down:
Main
MyClass
constructorMyClass
constructorMyMethod
Main
The static constructor will be called before mymethod is executed. However if you are screwed if 4 is called before 2 then I suggest you re-think your design. Should not be doing complicated stuff in a static constructor anyway.