Monday, October 25, 2010

Java/C#: Generics

Java and C# generics are quite similar, but the implementations are very different. Here are some useful links for the curious:

Summary:
In short, all that Java generics permit is greater type safety with no new capabilities, with an implementation that permits blatant violation of the type system with nothing more than warnings
Furthermore, C#/.NET convey additional performance benefits due to the lack of required casts (as the verifier ensures everything is kosher) and support for value types (Java generics don't work with the builtin types like int), thus removing the overhead of boxing, and C# permits faster, more elegant, more understandable, and more maintainable code.

No comments:

Post a Comment