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
What is the default value of decimal in c#?
what is an event? Define delegate?
Explain the difference between passing parameters by value and passing parameters by reference with an example?
Can arraylist hold primitive types?
What is a method signature c#?
What is string method in c#?
What are constants in c#?
Why do we parse in c#?
What are the variables in c#?
What is property c#?
What is type cast in C#?
When should I use static in C#?
What is lock statement in C#?
Can you pass value types by reference to a method?
What is default constructor in c#?