Article From:



Sometimes you need to know how long it takes to execute a method, and a time difference TimeSpan is used.

                DateTime startTime = DateTime.Now;//Method start time//{
                //    You need to test the code.//}
                DateTime endTime = DateTime.Now;//Method End Time

                TimeSpan tS = endTime - startTime;

View Code


Leave a Reply

Your email address will not be published. Required fields are marked *