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.
- An instance of that class is created
- Any of the static members of that class is accessed/referenced.
精彩评论