How do i free objects in C#
c#, memory-management, object, oop
Solution
You don't have to. The runtime's garbage collector will come along and clean it up for you. That is why you are using C# and not unmanaged C++ in the first place :)
Problem
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 like to free obj1, after it is no longer required and also more importantly its scope is the full run time of the program. */ ``` Thanks for all your help