J
Jack Addington
I have some 'service' classes that I instantiate when its service boolean is
enabled. When its disabled I want to destroy it. I'm not clear on if I
need to do this and if so how. Basically I have the following:
object ServiceXXX = null;
public void EnableServiceXXX(bool active)
{
if (active && ServiceXXX == null) ServiceXXX = new ServiceXXX(...);
else if (!active && ServiceXXX != null) ... ServiceXXX = null;
}
Is the last line the correct way to do it?
enabled. When its disabled I want to destroy it. I'm not clear on if I
need to do this and if so how. Basically I have the following:
object ServiceXXX = null;
public void EnableServiceXXX(bool active)
{
if (active && ServiceXXX == null) ServiceXXX = new ServiceXXX(...);
else if (!active && ServiceXXX != null) ... ServiceXXX = null;
}
Is the last line the correct way to do it?