correct way to store information to file when application shutdown
<p>One of my class collects statistics during application execution and I want to store this statistics to disk when application finished. I never destroy this class inside my program so I have tried to store logs to file like that:</p>

<pre><code>    ~Strategy()
    {
        foreach(var item in statisticItems)
        {
            log.WriteLine(item.Text);    // log is AutoFlush
        }
    }
</code></pre>

<p>However I do not see logs I expect to see and also I can not "catch" in debugger moment when destructor called.</p>

<p>Questions:</p>

<ul>
<li>Why In debugger I can not catch moment when destructor is called? Isn't destructor must be called for every object when program finishes?</li>
<li>What should I use to log my stuff?</li>
</ul>
