Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » C# / .NET / Cod... » Software   (RSS)

Is interlocked increment followed by comparison thread safe?

Sorry about the blog title, my imagination failed me :(. In our internal alias someone asked the question "Is the following thread safe" if(Interlocked.Increment(ref someInt) == CONSTANT_VAL) { doSomeStuff(); } My instant reaction was no because

C/C++ Compile Time Asserts

The Problem Run time asserts are fairly commonly used in C++. As the MSDN documentation for assert states " (assert) Evaluates an expression and, when the result is false, prints a diagnostic message and aborts the program. " There is another

Silverlight on Nokia S60 devices

In many of my blog posts (e.g. here and here ) I refer to .NET Compact Framework and Symbian OS (S60) and obviously folks keep asking me via comments (or assume) that we are porting .NETCF on S60 devices. So I thought it's time to clarify :) The short

Who halted the code

Today a bed time story involving un-initialized variable access and a weird coincidence. Couple of weeks back I was kind of baffled with a weird issue I was facing with the .NET Compact Framework Jitter. We were making the Jitter work for Symbian OS (S60)

Back To Basics: Finding your stack usage

Handling stack overflow is a critical requirement for most Virtual Machines. For .NET Compact framework (NETCF) it is more important because it runs on embedded devices with very little memory and hence little stack space. The .NETCF Execution Engine

A* Pathfinding algorithm animation screen saver

I'm trying to learn WPF and IMO it is not a simple task. Previously whenever I upgraded my UI technology knowledge it had been easy as it build on a lot of pre-existing concepts. However, WPF is more of a disruptive change. I decided to write some simple

How Many Types are loaded for Hello World

<Updated> Consider the following super simple C# code namespace SmartDeviceProject1 { class Program { static void Main(string[] args) { System.Console.WriteLine("Hello"); } } } Can you guess how many managed Type gets loaded to run this? I was doing

Designer for my path finding boards

I'm writing a small application (or rather a screen saver) that animates and demonstrates A* search algorithm . The idea is simple. On screen you see a start and end point and some random obstacles in between them. Then you see animation on how A* algorithm

String equality

akutz has one of the most detailed post on string interning and equality comparison performance metrics I have ever seen. Head over to the post here I loved his conclusion which is the crux of the whole story. " In conclusion, the String class’s
Posted by abhinaba | 1 Comments

Writing exception handlers as separate methods may prove to be a good idea

Let us consider a scenario where you catch some exception and in the exception handler do some costly operation. You can write that code in either of the following ways Method-1 : Separate method call public class Program { public static void Main(string[]

Do namespace using directives affect Assembly Loading?

The simple answer is no, the inquisitive reader can read on :) Close to 2 year back I had posted about the two styles of coding using directives as follows Style 1 namespace MyNameSpace { using System; using System.Collections.Generic; using System.Text;
 
Page view tracker