what's inadequacy ways formulating stationary instance singleton?
i have bug recently wholly manifested itself library built redeem build rather debug build. library .net dll com coupling i am controlling cocreateinstance emanate category dll an unmanaged c++ app. i finally tracked bug down caused accessing essay object. i essay instance announced so:
private stationary readonly myobjecttype s_instance = new myobjecttype;
and following accessed with:
public stationary myobjecttype instance
{
{
relapse s_instance;
}
}
this failing. changing to:
private stationary myobjecttype s_instance;
public stationary myobjecttype instance
{
{
(s_instance==null)
{
s_instance = new myobjecttype();
}
relapse s_instance;
}
}
fixed issue. any ideas since initial use didn't work there any downsides doing presumably way?
the redeem dll seemed ideally workable another managed app.
Comments
Post a Comment