BrainSlugs83
Member
I'm developing a class library in VB.NET.
One of my classes I do not want foreign code to be able to create an instance of, but the class must be public as another class will expose a public member which will be an instance of this class. That's a mouthful. An example of this type of behavior can be seen in "System.Drawing.Imaging.ColorPalette" -- it cannot be created. But if you "Dim bmp As New System.Drawing.Bitmap(1, 1, Imaging.PixelFormat.Format8bppIndexed)" then "bmp.Palette" will be a new instance of a "System.Drawing.Imaging.ColorPalette".
I want to do kind of the same thing with a class in my class library; How can I accomplish this?
One of my classes I do not want foreign code to be able to create an instance of, but the class must be public as another class will expose a public member which will be an instance of this class. That's a mouthful. An example of this type of behavior can be seen in "System.Drawing.Imaging.ColorPalette" -- it cannot be created. But if you "Dim bmp As New System.Drawing.Bitmap(1, 1, Imaging.PixelFormat.Format8bppIndexed)" then "bmp.Palette" will be a new instance of a "System.Drawing.Imaging.ColorPalette".
I want to do kind of the same thing with a class in my class library; How can I accomplish this?