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

Is it not possible to store a boolean value as a variable?

524


Explain how do I convert a string to an int in c#?

593


what happens if you inherit multiple interfaces and they have conflicting method names?

555


Is c# an open source language?

645


Can we overload indexer in c#?

562






What is sqlcommand in c#?

575


What's the difference between class and object?

565


What is sql transaction in c#?

572


How do you type a null character?

570


Contrast System.String and System.Text.StringBuilder classes?

603


What does assert() do in c#?

638


What is access specifier in c#?

651


Is c# a strongly-typed language?

626


What is native image generator (ngen.exe)?

775


What is datacontract in c#?

553