I have a winform
constructor with parameter:
public SnippingTool(Bitmap screenShot)
{
InitializeComponent();
this.BackgroundImage = screenShot;
...
}
I need only one instance of my winform
while app is running, so I decided to use singleton pattern.
I found this construction (it's not suitable because of parameter in my class constructor):
private static SnippingTool instance;
public static SnippingTool GetInstance
{
get
{
if (instance == null)
{
instance = new SnippingTool();
}
return instance;
}
}
How can I pass parameter through singleton?