I have a method that's called when I've done with a class I've created, I guess you could treat it like a dispose method, even though it isn't called Dispose(), but something else.
public void Destroy()
{
Array.Clear(SqState, 0, SqState.Length);
Array.Clear(SqFloorHeight, 0, SqFloorHeight.Length);
Array.Clear(SqSeatRot, 0, SqSeatRot.Length);
_staticModel = null;
Heightmap = null;
SqState = null;
SqFloorHeight = null;
SqSeatRot = null;
}
I was wondering if I even need to set the objects to null or will GC handle this for me? Their just basic var types like strings, doubles and integers, although _staticModel
is another class I've made.
I'm also not sure on if I need to clear the arrays (first 3 lines) and what that will even do? I'm just trying to get my head around disposing and what I should and shouldn't do in this situation.
So, I do apologise if this is a basic question, you're dealing with a dispose newbie here.