Is there an C# attribute (for method) to calculate the time of execution of this method? Is there another way?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you are wanting to write some test code to profile various functions or parts thereof you would use a System.Diagnostics.Stopwatch to keep track of elapsed time. Like this:
If it’s a more general thing you want to do (ie work out what parts of a program are slow) then use a profiler like some of the other answers suggest.