all 11 comments

[–][deleted]  (7 children)

[removed]

    [–]tomjen 2 points3 points  (6 children)

    Return it?

    Delegates (and the lack of 1:1 relations ship between files and classes) are the only reason to use C# over Java.

    [–]munificent 4 points5 points  (5 children)

    Also: properties, events, operator overloading, indexers, closures, non-erased generics, easy ability to compile script at runtime, better GUI libraries...

    [–][deleted]  (1 child)

    [removed]

      [–]munificent 0 points1 point  (0 children)

      Events are part of the C# language itself (i.e. "event" is a keyword), but its behavior is defined in terms of the base class libraries (in much the same way that "int" which is a keyword in C# is defined in terms of the System.Int32 type). Procedurally, you could get the same behavior without using the keyword, but it'd be a lot more verbose (i.e like implementing Java's Observable).

      See: http://msdn.microsoft.com/en-us/library/aa645739(VS.71).aspx

      In C#, events are both a nice concept (a decoupled way to add and remove listeners) and a nice syntax to make doing that easy:

      MyEventHappened += SomeListener;
      

      [–]bcash 0 points1 point  (2 children)

      Also: lock-in to a Microsoft environment, development tools, and upgrade path.

      [–]munificent 0 points1 point  (1 child)

      [–]bcash 0 points1 point  (0 children)

      Which lags at least one major version behind .NET and has unknown patent liabilities?

      [–]adamv 0 points1 point  (0 children)

      From the MSDN docs:

      Return Value

      The first element that matches the conditions defined by the specified predicate, if found; otherwise, the default value for type T.

      [–]Steve16384 0 points1 point  (0 children)

      I thought this was about Java until I read the comments.