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 Difference Between The System.array.copyto() And System.array.clone()?
What are partial classes and use of partial classes?
Please explain value types and reference types used in c#?
What is the data type for bit in c#?
What are the properties of string?
What is a lambda expression in c#?
How do I create a single-file assembly?
What is difference between array and arraylist in c#?
What are indexers in c# .net?
What is the difference between int16 and int32 in c#?
who is a protected class-level variable available to?
What is difference between value and reference types in C#.NET
Why abstract class can not be instantiated?
How to find Percentage, name ,College from a resume or document ? How to export these values to other page in C#?
how to sort an array in c#