public static String GetTimestamp(this DateTime value) { return value.ToString(mmssffff); }
DateTime start = DateTime.Now; //Start time DoFoo(); //Execute your method DateTime end = DateTime.Now; //End time TimeSpan timeDifference = end - start; //Time span between start and end = the time span needed to execute your method int difference_Miliseconds = (int)span.TotalMilliseconds; //Gives you the time needed to execute the method in miliseconds (= time between start and end in miliseconds)
System.Diagnostics.Stopwatch
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)