开发者

Static constructor in VB.NET

开发者 https://www.devze.com 2022-12-20 02:59 出处:网络
I am rewriting a C# class in VB.NET. The C# class has a static constructor in it: static Class() { ... } which, through the call stack, I found is called by the main window\'s InitializeComponent()

I am rewriting a C# class in VB.NET. The C# class has a static constructor in it:

static Class()
{
    ...
}

which, through the call stack, I found is called by the main window's InitializeComponent() method. Everywhere I've looked has told me that the corresponding static construc开发者_如何学运维tor in VB.NET is just:

Shared Sub New()
    ...
End Sub

But this method is never invoked. Am I creating my VB.NET static constructor right? Is it likely something else that has nothing to do with my static constructor?


The static constructor is triggered by the first of the following events to occur within an application domain.

  1. An instance of that class is created
  2. Any of the static members of that class is accessed/referenced.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号