C# 2.0: Using different versions of the same dll in one application

Lot of things have become really easy to do in C#2.0. I needed to load 2 versions of the same class library dll in my application. The format of output file had changed between versions. So I need to deserialize an xml using the older version and then convert it to the newer version and…


C# 2.0: no more lexer blues with nested templates

When generics got announced and I laid my hands on the C#2.0 compiler the first thing I tried is nested template usage. This C++ compiler (spec actually) gave me enough pain with this. Consider the following C++ code which uses the STL.#include “vector”using namespace std;int main(){ vector<int> vectorI; vectorI.push_back(5); vector<vector<int>> vectorV; vectorV.push_back(vectorI); return 0;} First glance…


C#: PG required, obscene case fall through code and Duff device

I had said before that I miss case fall through in C# and I promised that I’d write about some weird uses of this feature in C++.  I think the weirdest use of case statement was made by Tom Duff. He needed to write some code in C that copied an array of shorts into a…


C# : I hate commented out code

Even though retaining commented lines of code in your source-base is not a good thing, it’s a fact that they do exist. Whenever I see a chunk of code commented out I first make a yucky face and then the next thing that comes to my mind is why did someone do this (was he unsure??) and…


TeamBuild: Scheduled build using Team System

Sorry to all the folks who read my blog for C#. This ones about Team System and specifically about the Team Build module 🙂 Team Build does not have any in-built scheduler and so it does not provide scheduled builds out of the box. However, it does have a command line tool to start team-builds….


C#: I miss case fall through

We all have heard time and again that the default case fall through is not good (as in C/C++) and C# does not allow it. There has been enough debate on this but I still differ on this. I used to like it a lot and somehow when I do need to use it the…


C# 2.0: Loading plugins at run-time using late binding

I was working on a home project for creating a motion-detector that works using a webcam. Instead of using a baby-monitor I am planning to run this on an old computer. I’ll point the web-cam to my daugthers’ crib and the program would monitor both sound and her motions and ring an alarm in case she moves…



I am a Software Developer working on the .NET Compact Framework team. My interests include OOPS, Software design, Algorithms and programming in general. I am an Indian and speak Bangla natively. I work out of the Microsoft India Development center here in Hyderabad. In my previous lives I have worked with Texas Instruments on their IDE Code Composer Studio and with Adobe…


C# 2.0: get and set accessor can have different accessibility

One of the issues with properties in C#1.x is that the get and the set accessors get the same accessibility. In some situations you’d want to impose more usage restriction on the set accessor then on get . In the following sample both the get and set are public.class Employee{ private string m_name; public string Name…


C#: Why I cannot call protected method from derived class

Someone posted a comment in the internal alias on protected member access. The question is that the following code does not compile with the error “cannot access protected member Class1.Foo()“public class Class1{ protected void Foo() { }}public class Class2 : Class1{ private void Test() { Class2 a = new Class2(); Class1 b = new Class2();…