Can anyone please tell me how I can free objects in C#? For example, I have an object:
Object obj1 = new Object(); //Some code using obj1 /* Here I would l
You stop referencing them and let the garbage collector take them.
When you want to free the object, add the following line:
obj1 = null;
The the garbage collector if free to delete the object (provided there are no other pointer to the object that keeps it alive.)