As a response to this thread:
http://stackoverflow.com/questions/457822/what-are-the-things-java-got-right
What are the things C# got right?
Please don't list the things C# did wrong, just right.
As a response to this thread:
http://stackoverflow.com/questions/457822/what-are-the-things-java-got-right
What are the things C# got right?
Please don't list the things C# did wrong, just right.
Garbage collection, although you could say that is a .NET thing.
Structs, pointers (especially "pinning"), delegates, generics, assemblies, AppDomains, garbage collection, namespaces.
So that it doesn't look like mere fawning praise, here are a few things deliberately excluded from the list (though, in keeping with the spirit of the question, I won't elaborate on them):
finalization, coroutines (the "yield" keyword), collections API, platform neutrality
IDisposable/using pattern, null coelescing operator (??), extension methods
I really like MethodInvoke for coordinating threads to the main threads for updates (although this may be a .NET thing). Thread coordination in C/C++ was such a spectacular pain...
Also, just the whole thread starting and running syntax, with delegates, is just extremely useful.
Let's see,
using
statementExpression<Func<>>
... allows code to be reinterpreted at runtime, making Linq 2 SQL possible.Having been stuck developing in J2ME lately after my whole career in C#: Properties and delegates/events.
Does the C# stdlib count? Their regexp engine is (surprisingly, to me) one of the best I've seen. In particular, it supports arbitrary lookbehind (rare), and a MatchEvaluator delegate. Short of just giving me the parse tree (like CL-PPCRE), this is about as sweet as they come.
@"unescaped strings" (especially when used with regex. "\\s*\\d.\\d" or @"\s\d.\d"?)
It's hard to stay away from wonders of .NET Framework when answering such questions.
It's also hard to avoid repeating "LINQ" and "Lambda Expressions" over and over which are almost the coolest improvements done on a mainstream programming language.
I like the naming conventions, especially Microsoft's extra effort to kill ugly Hungarian prefixes like "m_" from MFC people. I believe code looks cleaner and less cluttered, making it much easier to read.
The "using() { }" method to hint compiler about an object's lifetime is also cool.
Aside from language features already mentioned, it was the people. Anders Hejlsberg at the helm. The whole C# and .NET Framework team for that matter. Community interaction was very important as well. C# was developed at the right time. Java was little too early, perhaps, but C# benefited from the huge growth of the internet in a time when blogs just started exploding in the developer space, and Microsoft payed attention and communicated a lot with the developer community. They wooed students, universities and colleges, threw free or cheap training events everywhere, and made the .NET Framework something that goes end-to-end from embedded systems (.NET Micro Framework) to desktop to server to database. They made tools and frameworks around .NET for the enterprise, and even put out XNA for XBox development. Plus everything tries to play nice with whatever language you'd like, or have to integrate with.
Compiling to the CIL/CLR infrastructure, and as a result:
and certainly tons more.
I move between Java/C++/C# a lot and outside of the many nice syntactic sugary elements of C# I think the best thing they got 'right' was the ability to use runtime reflection on generics.
Java really mucked up with Type Erasure in this respect.
Probably more .Net in general but ...
Pure simplicity ... whole experience of being a developer is forced in to pink and fluffy chill out mode by default :)
...
It's silly little things like no "Push" and "Pop" methods for working with collections. "Add" and "Remove" completely make more sense to me.
It thinks the way I do :)
But also "MSIL" ... need i say more :)