Static predicates, delegate inference and performance
November 24th, 2007C# 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 »












