Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool /// 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 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. ///
return void
コード例 #1
0
        void CloseCamera()
        {
            lock (m_sync)
            {
                if (m_videoCapture != null)
                {
                    m_videoCapture.Dispose();
                }
                m_videoCapture = null;

                if (m_image != null)
                {
                    m_image.Dispose();
                }
            }
        }
コード例 #2
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     released = true;
     cap.Release();
     cap.Dispose();
 }