Where does the dispose method lie and how can it be used to
clean up resources?

Answer Posted / rutu

Dispose() is available in System.IDisposable interface.
Microsoft has suggested two methods that can be invoked by
the programmer for the release of resources i.e Close() and
Dispose().
If any of the method is invoked by the programmer before
loosing the reference to an object, care must be taken to
avoid finalze() to be invoked on the same object when it is
garbage collected and we can do this using
GC.SuppressFinalise().

Public Sub Dipose()' or Close()
'write code here to release the resources
GC.SuppressFinalize(Me)
End Sub

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Give examples for value types?

479


How does foreach loop work in c#?

477


What is array and arraylist?

533


What is a concrete class in c#?

528


What will a loop recorder show?

542






What is a dictionary in c#?

489


What is the difference between writeline and write in c#?

422


Is it possible to execute multiple catch block for a single try statement?

579


Are enums static c#?

495


What is the task perform by clr?

570


What do you mean by shared assembly?

579


Which .gang of four. Design pattern is shown below?

489


What does f mean in c#?

507


What is the data type for bit in c#?

471


How many constructor can a class have?

461