I am fairly new to learning C# (from Java & C++ background) and I have a question about manual garbage disposal: is it even possible to manually destroy an object in C#?
Say you have a class matrix and you created two matrix objects aMatrix
and bMatrix
. In C# you can manually destroy (finalize) an object like so:
aMatrix = null;
GC.Collect();
The garbage collector will notice that your aMatrix
is null and will destroy (finalize) it. Whether or not this is a good idea is a different story.