Exemplo n.º 1
0
        // Dispose(bool disposing) executes in two distinct scenarios.
        // If disposing equals true, the method has been called directly
        // or indirectly by a user's code. Managed and unmanaged resources
        // can be disposed.
        // If disposing equals false, the method has been called by the
        // runtime from inside the finalizer and you should not reference
        // other objects. Only unmanaged resources can be disposed.
        void Dispose(bool disposing)
        {
            if (m_contractHandle != null)
            {
                if (disposing)
                {
                    try
                    {
                        m_contractHandle.Dispose();

                        if (m_enumerator != null)
                        {
                            m_enumerator.Dispose();
                        }
                    }
                    catch (AppDomainUnloadedException) { }
                    catch (RemotingException) { }
                }

                m_contractHandle = null;
            }
        }