Coffeehouse Post

Single Post Permalink

View Thread: C# biggest awesome
  • User profile image

    This is the mathematical dual to the "C# biggest mistake" topic. What do you think is C#'s best feature?


    As a former .NET programmer now professional Java programmer, I have think I have a pretty good perspective on C# in relation to Java. And the single thing that I think could be most useful in Java would be delegates (and the closures/lambdas, but even just delegates would be a godsend).


    Event-driven programming is so crappy in Java that many Java programmers will do everything to avoid it. For example, to do what a simple event does in C#, you'd need to write an single method Interface and than wire a collection to a subscribe, unsubscribe and fire method in the producer. For every event! Talk about file pollution.


    And the result is still inadequite compared to C#. I still can't pick my own method names for subscribing to the event, that's part of the interface...


    I've noticed that a lot Java programmers don't see anything wrong with polling on a method every few seconds instead of writing an event. Seriously!


    So what are your thoughts? What you consider C#'s best feature?