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

Answers were Sorted based on User's Feedback



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

Answer / mohan kumar e.

The dispose method is available in System.IDisposable
interface.If you want to provide cleanup mechanism then
implement this interface and provide the definition for
dispose() method.

Is This Answer Correct ?    2 Yes 0 No

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

Answer / 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

More C Sharp Interview Questions

What is a pre-requisite for connection pooling?

2 Answers  


What is the partial class in C# What is the use of partial class in C#?

6 Answers   CTS,


What is an example of a delegate?

0 Answers  


What does a constructor do c#?

0 Answers  


what is application domain?

4 Answers   Kanbay,






what is the syntax to inherit from a class in c#?

0 Answers   Siebel Systems,


Which technology is best for desktop application?

0 Answers  


What are console applications used for?

0 Answers  


What is a multicast delegate in c#?

0 Answers  


What is difference between string and string builder?

0 Answers  


What is thread safe in c#?

0 Answers  


Are c# strings null terminated?

0 Answers  


Categories