F
Flix
When making c# programs, I usually write code like this:
[...]
SomeType myType=null;
[..]
void Init()
{
myType=new SomeType();
}
[...]
void SomeFunction()
{
if (myType==null) return;
else
{
[...]
}
}
My first question is how to do to delete an initialized object:
myType=null is enough?
Or myType.Dispose();myType=null; ?
My second question is how to delete and reinitialize it in a correct way:
myType=new SomeType(); deletes the first instance of myType automatically ?
(even if myType is a runnig Thread?)
Thank you in advance.
[...]
SomeType myType=null;
[..]
void Init()
{
myType=new SomeType();
}
[...]
void SomeFunction()
{
if (myType==null) return;
else
{
[...]
}
}
My first question is how to do to delete an initialized object:
myType=null is enough?
Or myType.Dispose();myType=null; ?
My second question is how to delete and reinitialize it in a correct way:
myType=new SomeType(); deletes the first instance of myType automatically ?
(even if myType is a runnig Thread?)
Thank you in advance.