Archive | February, 2011

Using the .NET Stopwatch class to Profile Your Code

The Stopwatch class in the System.Diagnostics namespace can be used a as a basic tool to profile blocks of .NET code. System.Diagnostics.Stopwatch timerObj = new System.Diagnostics.Stopwatch(); timer.Start(); Decimal totalDec = 0; int limit = 1000000; for (int i = 0; i < limit; ++i) { totalDec = totalDec + (Decimal)Math.Sqrt(i); } timerObj.Stop(); Console.WriteLine(“Sum of square [...]

Read more

Ensure a .NET App Works in Both 32 bit and 64 bit Environments

With 64 bit versions of Windows fast becoming the standard it is imperative that an app work in both 32 bit and 64 bit environments. This done using a basic configuration setting, with a few caveats of course. In Visual Studio in the project’s build options you can select the app’s Platform target, which can [...]

Read more