コード例 #1
0
            /// <summary>
            /// Releases the unmanaged resources used by the <see cref="IoSession"/> object and optionally releases the managed resources.
            /// </summary>
            /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
            protected override void Dispose(bool disposing)
            {
                if (!m_disposed)
                {
                    try
                    {
                        // This will be done regardless of whether the object is finalized or disposed.

                        if (disposing)
                        {
                            if (m_dataIoSession != null)
                            {
                                m_dataIoSession.Dispose();
                                m_dataIoSession = null;
                            }

                            // This will be done only when the object is disposed by calling Dispose().
                        }
                    }
                    finally
                    {
                        m_dataIoSession = null;
                        m_disposed      = true;     // Prevent duplicate dispose.
                        base.Dispose(disposing);    // Call base class Dispose().
                    }
                }
            }
コード例 #2
0
 /// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 /// <filterpriority>2</filterpriority>
 public void Dispose()
 {
     GC.SuppressFinalize(this);
     IsDisposed = true;
     if (SourceData != null)
     {
         SourceData.Dispose();
         SourceData = null;
     }
     if (DestinationData != null)
     {
         DestinationData.Dispose();
         DestinationData = null;
     }
     if (SourceIndex != null)
     {
         SourceIndex.Dispose();
         SourceIndex = null;
     }
     if (DestinationIndex != null)
     {
         DestinationIndex.Dispose();
         DestinationIndex = null;
     }
 }