Static class constructor in VB
c#, vb.net
Solution
You cannot declare a shared class in VB.NET. You have two options:
- use modules. In this case you need some `Init`, which you need to call before anything else.
- use regular classes with Shared methods (my preference), then you can have shared sub new.
Problem
Is there a way to make a constructor for a `shared` class in VB.NET? I do it all the time in C# as follows, but I can't seem to get it to work in VB.NET. ``` static class someClass { public static string somePublicMember; static someClass() { messageBox.show("I just constructed a static class"); } } ``` When the following code is executed, the constructor will be called. ``` ... someSillyClass.someSillyPublicMember = 42; ... ``` Can a `static` (`shared`) class even have a constructor in VB.NET?