public void Dispose() { if (connection != null) { connection.RemoveSubscription(this); connection = null; } if (subscriptionPtr == IntPtr.Zero) { return; } C.CheckOk(C.Instance.dxf_close_subscription(subscriptionPtr)); subscriptionPtr = IntPtr.Zero; }
/// <summary> /// Dispose native snapshot subscription /// </summary> /// <exception cref="NativeDxSubscription"></exception> public void Dispose() { if (connection != null) { connection.RemoveSubscription(this); connection = null; } if (snapshotPtr == InvalidSnapshot) { return; } C.CheckOk(C.Instance.dxf_close_snapshot(snapshotPtr)); snapshotPtr = InvalidSnapshot; eventType = EventType.None; }
private bool disposedValue = false; // To detect redundant calls /// <summary> /// This code added to correctly implement the disposable pattern. /// </summary> protected virtual void Dispose(bool disposing) { if (connection != null) { connection.RemoveSubscription(this); connection = null; } if (disposedValue) { return; } if (disposing) { if (subscription != null) { subscription.Dispose(); subscription = null; } } disposedValue = true; }