Hello All
I have two classes ClassA and ClassB both having a reference to a singleton object ClassHelper. My question is how should i dispose the singleton object once im done using both the ClassA and ClassB
Edit:
public ClassA
{
CHelper obj;
public ClassA()
{
obj = obj.GetInstance("Initialise");
obj.CallFuncA();
}
}
On the same lines
public ClassB
{
CHelper obj;
public ClassB()
{
obj = obj.GetInstance("Initialise");
obj.CallFuncB();
}
}
where
CHelper
{
private static sm_CHelper;
public static GetInstance(string strInitialise)
{
if(sm_CHelper == null)
{
sm_CHelper = new CHelper(strInitialise);
}
}
private CHelper(string strInitialise)
{
//do something here
}
public CallFuncA()
{
// do something here
}
public CallFuncB()
{
// do something here
}
}
Regards Learner