How does a static constructor work?

前端 未结 10 1324
迷失自我
迷失自我 2020-12-04 06:03
namespace MyNameSpace
{
    static class MyClass
    {
        static MyClass()
        {
            //Authentication process.. User needs to enter password
                


        
10条回答
  •  盖世英雄少女心
    2020-12-04 07:10

    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.

提交回复
热议问题