Static predicates, delegate inference and performance

November 24th, 2007

C# 2.0 introduced a feature called delegate inference. Delegate inference is an simplification of how you initialize delegates.

Where you prior to C# 2.0 would have to write:

MyDelegate d = new MyDelegate(MyFunction);

You can now simply write:

MyDelegate d = MyFunction;

The two lines of code behaves exactly the same. They construct a new instance of MyDelegate passing MyFunction as argument to the constructor, and then assign the instance to the variable d.

As the name ‘delegate inference’ suggests, the compiler fills in the ‘missing parts’ using inference, leaving the developer with less keystrokes and more readable code. Which is a good thing. Read the rest of this entry »

The bad thing about String.IsNullOrEmpty…

November 8th, 2007

…is that it makes me wonder why they didn’t throw in Array.IsNullOrEmpty as well.

-petter

Powered by WordPress. Entries (RSS) and Comments (RSS).