We do not know the details of your code, but the fact that your class library should be aware of the process output may indicate a design flaw in your application.
If you need to free resources or clean up other things in a deterministic way, you should take a look at the IDisposable interface. If the classes represented by your library implement this interface, the caller can easily state that they no longer need the dll functionality by calling Dispose() .
Perhaps the following articles are a good starting point for further reading:
For example, your class library might have the following class:
using System; using System.IO; public class ResourceManager : IDisposable { private Stream _resource; private bool _disposed; public void Dispose() { Dispose(true);
In the main module, you can use it as follows; The using statement ensures that the Dispose() method is called:
using System; using System.Windows.Forms; static class Program {
Dirk vollmar
source share