Saturday, 1 October 2016

How to destroy an object in C#

In addtion to setting your object as null , you should also remove it from other objects which refrences it as well
if you class uses resources that needs to be freed up use IDisposable


public class Car: IDisposable
{
// free resources
public void Dispose()
{
}
}

No comments:

Post a Comment