var timer = new Stopwatch();
timer.Start();
//B: Run stuff you want timed
timer.Stop();
TimeSpan timeTaken = timer.Elapsed;
string foo = "Time taken: " + timeTaken.ToString(@"m:ss.fff");
var timer = new Stopwatch();
timer.Start();
// do stuff
timer.Stop();
}