Skip to content

Instantly share code, notes, and snippets.

@rdelrosario
Created April 28, 2021 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rdelrosario/ba6765db51becb119b409a8863698702 to your computer and use it in GitHub Desktop.
Save rdelrosario/ba6765db51becb119b409a8863698702 to your computer and use it in GitHub Desktop.
using System;
using System.Reactive.Disposables;
using ReactiveUI;
namespace DynamicDataGroupingSample
{
public abstract class ReactiveObjectEx : ReactiveObject, IDisposable
{
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Dispose all of your Rx subscriptions with this property.
/// </summary>
protected readonly CompositeDisposable Subscriptions = new CompositeDisposable();
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
Subscriptions?.Dispose();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment