Tic-Tac-Toe game in Silverlight

Recently someone asked me to write a TicTacToe game. So I worked out a rough logic for it. Heres the code. The idea is that the computer first scans through the tic-tac-toe board for any winning positions available. If none are available, then it looks for the manual user’s winning positions. If its able to [...]

Thread Synchronization techniques Part 2 - The ReaderWriterLock class

In continuation to my earlier post about multithreading in .NET, I am writing about the ReaderWriterLock class which is one more method of thread synchronization.

The ReaderWriterLock is based on the fact that the Monitor locking (lock keyword in C#) doesnt really make any distinction whether the thread accessing the variable is [...]

Mars Rover Coordinates problem - Solution

I got an interesting problem by email recently where someone had asked me to solve the given below problem:-

A squad of robotic rovers are to be landed by NASA on a plateau on Mars.This plateau, which is curiously rectangular, must be navigated by therovers so that their on-board cameras can get a complete view of [...]

Differences between Events and delegates

Events and Delegates are quite tied together in .NET, but there are differences in terms of usage. Events are implemented through delegates, but they are not quite interchangeable. The event keyword is an access modifier on the delegate which restricts its usage outside the class which it belongs to.

First the similarities. [...]

Lambda expressions in C#

In the previous post we saw how anonymous methods can help reduce verbose delegate code. With C# 3.0, there was a new language feature introduced which further reduces the delegate code – Lambda expressions.

Lambda expressions use automatic type inference, which relieves you of explicitly declaring the type. Here is a simple example of lambda [...]

Delegate Chaining in C# .NET

Delegates are not just function pointers with a fancy name, they are a huge leap over C++’s function pointers. Unlike unmanaged languages, .NET enforces type safety for its delegates. Good, because pointers are too scary to be tolerated in .NET’s perfect world, where there are no memory leaks and all a developer [...]

WPF through the C# command line compiler csc.exe

I don’t have the Visual Studio 2008 IDE at work. To get around that I write WPF entirely though code in Notepad and compile it with the command line compiler installed with the Framework. Painful, yeah, but it makes for much better learning. The IDE makes things much easier through intellisense, code generation which makes [...]

Nested Controls in WPF

Unlike conventional windows Forms applications, WPF supports Nested controls. i.e. one control can reside inside other controls, something that is not possible in Windows Forms where all the controls belong to one container. Lets see how this is Possible. Many controls in WPF has a content property. The Content property is what the control displays. [...]

Visual Studio Express 2010 IDE

Around a week back, the Visual Studio 2010 express editions beta2 versions were up for download. I immediately downloaded it and got my hands dirty trying to adjust to the new IDE. Here are some snapshots of the Visual Studio 2010 C# express edition and how it differs from its predessecor.

First the splash screen, abandoning [...]