where to dispose StreamWriter if I need it during entire application lifetime?
<p>Where to dispose StreamWriter if I need it during entire application lifetime? I'm going to dispose it in destructor, will that work? I have to dispose to flush data, and I don't want to use <code>AutoFlush</code> feature because from msdn: <code>"You can get better performance by setting AutoFlush to false, assuming that you always call Close (or at least Flush) when you're done writing with a StreamWriter."</code></p>

<p>So should i <code>Dispose</code> in destructor like in the code below?</p>

<pre><code>class Log
{
    private static StreamWriter swLog = new StreamWriter("logMAIN.txt");

    static ~Log()
    {
        swLog.Dispose();
    }

    public static void Push(LogItemType type, string message)
    {
        swLog.WriteLine(type + " " + DateTime.Now.TimeOfDay + " " + message);
    }
}
</code></pre>

<p><strong>upd</strong> instead of <code>Dispose</code> i meant to call <code>Close</code> but it is not improtant in this case because they seems doing exactly the same.</p>
