In .Net 1.0 and 1.1, we got used to creating a private constructor if we wanted to prevent someone from creating an instance of our class. If we did not define a constructor, the default constructor was compiled for use, and the user could create an empty instance. So we prevented this by creating the private constructor. In C# we have classes, but in VB, there are classes and then modules which can contain only static (Shared) methods. In .Net v2.0 Beta 1, C# can have the static keyword applied to classes to prevent them from having instances. Now, I've deleted my private contructor and applied the static keyword! There's not going back now!
Posted
08-23-2004 2:42 PM
by
Jeffrey Palermo