I was reading Wikipedia the other day, and saw this:
C# has partial anonymous function support through the use of delegates. … Since anonymous methods are not nameless and can only be declared inside methods of classes then C# does not support full anonymous functionality.
Hmph, who’s in charge here? I don’t really feel any ownership for Wikipedia, but that is just bad info. So I rewrote it.
The updated entry, including the comments on C#, is here: http://en.wikipedia.org/wiki/Anonymous_function
If you want to read all about the anonymous function support added in C# v3.0, then go the the source – MSDN.
Leads me to a couple other notes here.
First, yes, I agree it is a pain that the language compiler version has a different version than the framework. So we have C# 3.0, but it shipped with the .NET Framework v3.5. Confused? You should be. All I can say is, we apologize. there are good reasons we are confusing you. We’re not doing it on purpose, it just works out that way.
Second, at first I approached the new C# language stuff with a little trepidation. I mean, lambdas? Extension methods? All of this stuff sounds a little esoteric. But after exploring a little bit, I have found good uses for these new language constructs, even outside the coolness that is LINQ. It’s the little things. For example, I can convert a version string like 188.8.131.52 into a List<int> with a single line of code, using the ConvertAll() method and a lambda expression.
That kind of thing is just pretty cool. Also I use the object initializers all the time now.
Last, I wonder how much of the wikipedia thing works this way – people just feel like they don’t want bad info out there, and are sort of transparently taxed into writing the articles themselves. This is sort of like trash collection in Seattle. When I lived in Pennsylvania, trash collection was just included in the taxes, and you could throw anything away. I could put a used car on the curb with a note on the windshield saying “Trash”, and the trash man would come and haul it away. But in the Seattle area, you can’t throw just anything away. There’s a limit. If you want to discard an appliance, for example, you have to take it to the dump yourself.
There’s something to be said for the Pennsylvania model – basically it means that there’s no reason to be a “bad actor” and throw trash out in an empty lot. Whatever you want to throw out, they’ll haul away. It’s taken care of for you. (Like Encyclopedia Britannica). On the other hand the Seattle approach means people who discard a lot of stuff, have to pay more, and make more of an effort. (like Wikipedia).
Well I’m obviously rambling now. . .