A C# example of a factory that creates and stores IDisposable instances so that when the factory is disposed, so are the instances.