C# – not able to use stopwatch.Restart()

c++, unity3d

I'm trying to call Restart() on a stopwatch instance but am getting the following error when trying to call it:

Assets/Scripts/Controls/SuperTouch.cs(22,59): error CS1061: Type
System.Diagnostics.Stopwatch' does not contain a definition for
Restart' and no extension method Restart' of type
System.Diagnostics.Stopwatch' could be found (are you missing a using
directive or an assembly reference?)

This is my code:

using UnityEngine;using System.Collections;using System.Collections.Generic;using System.Diagnostics;namespace Controls{    public class SuperTouch    {            public Vector2 position { get { return points [points.Count - 1]; } }            public float duration { get { return (float)stopwatch.ElapsedMilliseconds; } }            public float distance;            public List<Vector2> points = new List<Vector2> ();            public Stopwatch stopwatch = new Stopwatch ();            public void Reset ()            {                    points.Clear ();                    distance = 0;                    stopwatch.Restart ();            }    }}

Best Solution

I'm guessing you use pre 4.0 framework, which means you'll have to use Reset and Start instead of Restart.