Question

I am having trouble creating a simple Stopwatch object. Even though in other projects I am able to use it without any issue whatsoever, in my Lightswitch application this code:

System.Diagnostics.Stopwatch relojito = new System.Diagnostics.Stopwatch();

Produces nothing. I am using VS2012 and already checked all available objects on System.Diagnostics and Stopwatch is not there.

Am I doing something wrong? It's built in .NET 4.5 framework.

EDIT: It doesn't compile at all when I do this (type or namespace Stopwatch does not exist in System.Diagnostics error)

Was it helpful?

Solution

The System.Diagnostics.Stopwatch class doesn't exist in Silverlight 4 or higher (which is what LightSwitch is using), so you can't use it in a LightSwitch project.

On another note, you should be using .NET 4.0 in any LightSwitch code, not .NET 4.5.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top