I assume that you are using .Net Framework 3.5or below where the method Restart Stopwatchdoes not exist.
If you want to reproduce the same behavior, you can do it as follows.
Stopwatch watch = new Stopwatch();
watch.Start();
watch = Stopwatch.StartNew();
StartNew .Net Framework 2.0
StartNew : .
, , .
.
public static class ExtensionMethods
{
public static void Restart(this Stopwatch watch)
{
watch.Stop();
watch.Start();
}
}
class Program
{
static void Main(string[] args)
{
Stopwatch watch = new Stopwatch();
watch.Restart();
}
}