How we free the memory in C#.NET.

Answer Posted / prashanth s

Actually the freeing of the memory is done by the CLR
automatically by calling the garbage collection routine.
But the declared objects by the user can be deallocated
manually by using dispose function in the class by
implementing IDisposable interface in the object class.
Otherwise it can also be done by implementing a destructor
in the class, as the destructor defined will help
deallocating the object allocation after the usage of the
object gets over, i.e the object is not used anywhere else
in the program.

Is This Answer Correct ?    15 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Name the method of servicebase class?

745


What is firstordefault c#?

732


What's the difference between system.string and system.text.stringbuilder classes?

749


What are annotations in c#?

714


What is collection class c#?

697


Can a constructor be static in c#?

755


How main method is called in c#?

714


What is action c#?

677


What is an extension method in c#?

725


What is decimal in c#?

682


What is the default value of boolean variable?

672


What is the difference between “out” and “ref” parameters in c#?

711


What is the advantage of dependency injection?

730


List some of the classes used by system.data namespace?

619


How do you determine whether a string represents a numeric value?

722