using Timer to know the age of an object
<p>I am writing a class named Food. I considered a field “int cookingTime” to see how long each instance of this class has been existed. I assumed I should use the Timer class. I wrote the following piece of code but it did not work. I am not sure if my approach is correct . I really appreciate any help.</p>

<pre><code>Class Food
{ 

    private System.Timers.Timer timerClock = new System.Timers.Timer();

    static int cookingTime = 0;

    public Food()
       {

           this.timerClock.Elapsed += new System.Timers.ElapsedEventHandler(process);
           this.timerClock.Interval = 1000;
           this.timerClock.Enabled = true;

    }

    static void process(Object myObject, EventArgs myEventArgs)
    {

        cookingTime += 1;
    }

}
</code></pre>
