Which code segment should you use?

You create a Web Part that calls a function named longCall. You discover that longCall takes a
long time to execute. You need to display in the Developer Dashboard how long it takes to
execute longCall. Which code segment should you use?

You create a Web Part that calls a function named longCall. You discover that longCall takes a
long time to execute. You need to display in the Developer Dashboard how long it takes to
execute longCall. Which code segment should you use?

A.
DateTime startTime = DateTime.Now; longCall(); Trace.TraceWarning(“Long Call ” +
DateTime.Now.Subtract(startTime).Seconds);

B.
Monitor.Enter(“Long Call”); if (true) { longCall(); } Monitor.Exit(“Long Call”);

C.
using (SPMonitoredScope monitoredScope = new SPMonitoredScope(“Long Call”)) {
longCall(); }

D.
DateTime startTime = DateTime.Now; longCall(); Trace.Write(“Long Call ” +
DateTime.Now.Subtract(startTime).Seconds);



Leave a Reply 0

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