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 the use of regex in c#?

0 Answers  


how can i display crystalreport in button click? am working with VS2005

1 Answers  


Which sorting algorithm is best?

0 Answers  


how to retrive a TextBox value in to Sql database using C# windows form application coding

3 Answers  


How structure objects are destroyed? As GC releases only the objects in stack, and structure is a value type and stored in heap. So how structure objects are released?

2 Answers  






What does console readline do?

0 Answers  


What is the use of GC.KeepAlive Method?

0 Answers   HCL,


What is wrong with the sample program below?

0 Answers  


hi In my database i put id column as identity(the database is incremented by it self only)what i want is if i enter a data in my website, id will come automatically can u pl z tell me the code thax in advance

1 Answers  


Can you describe iuknown interface in short?

0 Answers  


What are assemblies?

0 Answers   Microsoft,


What is protected internal modifier in C#?

0 Answers   Arigo Infotech,


Categories