In a class that contains only managed resources

suggest change

Managed resources are resources that the runtime’s garbage collector is aware and under control of. There are many classes available in the BCL, for example, such as a SqlConnection that is a wrapper class for an unmanaged resource. These classes already implement the IDisposable interface – it’s up to your code to clean them up when you are done.

It’s not necessary to implement a finalizer if your class only contains managed resources.

public class ObjectWithManagedResourcesOnly : IDisposable
    private SqlConnection sqlConnection = new SqlConnection();

    public void Dispose()

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents