I would like to know if it is possible to get a query ‘search results’ time? Like how google has a time under each query – this is the time it took to complete the search.
How is this achievable? I haven’t attempted anything (hence no code) because, well, I’m not sure where to start.
LINQPad has this feature built in, but I’d like to get something similar going on an internal mvc app I’m working on.
Thanks
You could use the
Stopwatchclass to measure the duration of the execution of your query (or any other code).In the case of LINQ queries, don’t forget that these are only evaluated on demand using deferred execution. Thus, you would probably want to force their enumeration (using, for example,
ToList) in order to get a true measure of their execution’s duration.