views:

172

answers:

1

I am rewriting a C# class in VB. 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 constructor in VB is just:

Shared Sub New()
    ...
End Sub

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

+1  A: 

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 member of that class is accessed/referenced.
adatapost
Yeah, you were right. They were creating a temporary class to invoke the static trigger.
smoore