static / volatile in Singletons
<p>Does it make sense to make a <code>System.Timers.Timer</code> member of a singleton <code>volatile static</code>? </p>

<p>Would it make any difference if I make the <code>_fooTimer</code> <code>static</code> and or <code>volatile</code> in singleton instance context?</p>

<p>Would it make any difference if I dont make <code>_instance</code> <code>static</code>?</p>

<p>EDIT2: I corrected the codesample and made it now ba better Singleton without unecessary static or volatile fields and changed to Interlock.Increment</p>

<pre><code>public sealed class Foo
{
   private static readonly object _syncRoot;

   private int _counter; 

   private Timer _fooTimer;

   private static Foo _instance;

   private Foo()
   {
       _counter = 0;
       _syncRoot = new object();
       _fooTimer = new new Timer();
       _fooTimer.Intervall = 3600000;
       _fooTimer.Elapsed += new ElapsedEventHandler(LogFoo);
   }

   public static Foo Instance
   {
        get
        {
            lock(_syncRoot)
            {
                 if (_instance == null)
                 {
                      _instance = new Foo();
                 }
            }
            return _instance;
        }
    }

    private void LogFoo()
    {
         // write a logfile with _counter - then restart timer and set _counter to 0
    }

    public void Increment()
    {
         Interlocked.Increment(_counter);
    }
}

public class UseTheFoo
{         
     // Foo.Instance.Increment()         

     ...
}
</code></pre>
