Reputation: 6403
I want to know how much time a specific code in my App takes ?!!! Thank you
Upvotes: 1
Views: 455
Reputation: 30862
Aside from @Darins answer you won't be able to measure page load time on the client as they are across a network and there are many variables involved (i.e. You can start a javascript timer as the page would need loaded first). However anything on the server can be timed.
Upvotes: 0
Reputation: 1038710
You could use the Stopwatch class:
var watch = Stopwatch.StartNew();
// Run your code here
watch.Stop();
long milliseconds = watch.ElapsedMilliseconds;
Upvotes: 7