It appears that a simulated static fianalizer described in this S.O. answer, https://stackoverflow.com/a/256278/449837, works in both web and non-web applications.
Here's a sample that I have working:
public class ClassThatNeedsStaticFinalizer {
// ... other class properties, methods, etc ...
#region Static Finalizer Emulation
static readonly Finalizer finalizer = new Finalizer();
private sealed class Finalizer
{
~Finalizer()
{
// ... Do final stuff here ...
}
}
#endregion
}
(NOTE: For some code scratchpad environments like LinqPad, ~Finalizer may not fire until the scratchpad app itself closes)