public static void OnDispose(this IDisposablePattern disposablePattern) { foreach (var disposeAction in disposablePattern.DisposeActions) { disposeAction(); } disposablePattern.DisposeActions.Clear(); disposablePattern.DisposeNativeResources(); }
// NOTE: Leave out the finalizer altogether if this class doesn't // own unmanaged resources, but leave the other methods // exactly as they are. public static void OnDestruct(this IDisposablePattern disposablePattern) { // Finalizer calls Dispose(false) disposablePattern.DisposeNativeResources(); }