dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [DotGNU]lesson in dispose


From: Neil Cawse
Subject: RE: [DotGNU]lesson in dispose
Date: Sun, 16 Nov 2003 13:07:44 -0500

Thanks.

If we implement a class in pnetlib that has no managed resources but ms
has implemented IDispose because they use unmanaged resources - a case
that is common, then we need to just do:

public class PnetlibClass : IDisposable
{
    public void Dispose()
    {
        this.Dispose(true);
    }
    protected void Dispose(bool disposing)
    {
    }
}

No finalizer.

Also, in the case where we are wrapping unmanaged resources, I guess the
finalizer should be there in case the user hasn't used the class with a
"using" statement or forgets to call Dispose directly.

Neil


reply via email to

[Prev in Thread] Current Thread [Next in Thread]