On static class On Enables the Dispose syntax. Documentation Code public static IDisposable Dispose(Action action) Wraps an action so that it is executed when the returned object is disposed. This disposal is thread-safe and the action will be executed at most once.