C# 3.0: Lambda expressions. I don’t like it that much

This is the my third post on the series of post I am making on C#3.0 after it got declared on PDC. See the previous two here and here. It’s not that I do not like lambda expression, I just don’t like that its being supported in C#. Lets first see what its like and…

59

C# : Enum and overriding ToString on it

I saw two posts on Enums today on Eric Lipperts and Chris Rathjen’s blog. Enums are significantly different from the other types and people run into unusal problems while working with them. C++ The CLI enum is considerably different from the native C++ enum and therefore you need to be careful how you define and use them in…

50

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…

33

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…

32

software piracy in India

I always tried to figure out that in spite of the fact that India will become one of the largest PC markets in the future and that India SW engineers are everywhere, why is there no mainstream software in Indian languages. Yea there is Windows Hindi, and I read somewhere that Windows Bengali is also…

31

C# 3.0: I love object and collection initializers

This is the my fourth post in the series of posts I am making on C#3.0. See the previous posts here, here and here Object and collection initializers are new features in C#3.0 which is syntactic sugar over how you allocate and initialize objects and collections. Object Initializers Lets consider a classclass Customer{ public string name;…

29

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…

29

C#: Anonymous methods are not closures

<Edit: See the extended discussion at the end of which I conclude Anonymous methods are indeed lexical closures!!! > Anonymous methods in C# are just anonymous methods and do not represent true lexical closure. There are a lot of samples and code out there explaining why. I use a simple example in my mind to remember why…

27

C# 3.0: I do not like Anonymous types

This is the my fifth post in the series of posts I am making on the new features in C#3.0. See the previous posts on var, extension method, lambda expressions and object-collection initializers Before getting into why I do not like (actually hate) anonymous types in C#. Let’s see what is this anonymous types and whats so…

26

C# 2.0: Generics, default(T) and compare to null weirdness

<Added additional stuff after a discussion on internal CSharp user list> I was going through the generics spec in C#2.0 and found something really weird. default(t) Consider the following code. class MyGenClass<T>{ public void Method(ref T t) { t = null; }} This will not compile because because T may be a value type as…

25