protected virtual void Dispose(bool disposing) { System.Diagnostics.Debug.Assert(disposing == true, "MMNotificationClient not disposed."); try { using (MMDeviceEnumerator enumerator = new MMDeviceEnumerator()) { CoreAudioAPIException.Try(enumerator.UnregisterEndpointNotificationCallbackNative(this as IMMNotificationClient), c, "UnregisterEndpointNotificationCallback"); } } catch (CoreAudioAPIException) { throw; //0x80070490 } }
/// <summary> /// Disposes und unregisters the <see cref="MMNotificationClient"/>. /// </summary> /// <remarks>In order to unregister the <see cref="MMNotificationClient"/>, this method calls the <see cref="MMDeviceEnumerator.UnregisterEndpointNotificationCallback"/> method.</remarks> public void Dispose() { if (!_disposed) { _disposed = true; try { CoreAudioAPIException.Try(_deviceEnumerator.UnregisterEndpointNotificationCallbackNative(this), InterfaceName, "UnregisterEndpointNotificationCallback"); } finally { _deviceEnumerator.Dispose(); } GC.SuppressFinalize(this); } }