Which interface allows to implement the Dispose method to do cleanup work

  1. Idestructor

  2. Icleanup

  3. Idisposable


Correct Option: B

AI Explanation

To answer this question, you need to understand the concept of resource cleanup in object-oriented programming.

Option A) Idestructor - This option is incorrect because the IDestructor interface does not exist in .NET or C#. A destructor is a special method used to clean up resources and is defined within a class, not an interface.

Option B) ICleanup - This option is incorrect because the ICleanup interface does not exist in .NET or C#. There is no predefined interface specifically for cleanup purposes.

Option C) IDisposable - This option is correct because the IDisposable interface in .NET allows a class to implement the Dispose method, which is responsible for releasing unmanaged resources such as file handles or database connections. The Dispose method is typically used for cleanup operations.

The correct answer is C) Idisposable. This option is correct because the IDisposable interface allows a class to implement the Dispose method for cleanup work.

Find more quizzes: