Almost four years ago I wrote an article entitled C# from a Java Developer's Perspective which is still one of the most popular comparisons of C# and Java on the Web. The article gets a couple thousand hits a month and I still get email about it from developers thanking me for writing it. Given the amount of changes in Java 1.5 5.0 and C# 2.0 I think the time has come to update this article. Below is my proposed table of contents for the new version. I'd appreciate comments on anything people thing is either missing or placed incorrectly.
-
The More Things Change The More They Stay The Same
This section describes concepts and language features that are almost exactly the same in C# and Java.
- We Are All Objects
- Keyword Jumble
- Of Virtual Machines and Language Runtimes
- Heap Based Classes and Garbage Collection
- Arrays Can Be Jagged
- No Global Methods
- Interfaces, Yes. Multiple Inheritance, No.
- Strings Are Immutable
- Unextendable Classes
- Throwing and Catching Exceptions
- Member Initialization at Definition and Static Constructors
- Generics - new!!!
- Boxing - new!!!
- Variable Length Parameter Lists - new!!!
-
The Same But Different
This section describes concepts and language features that differ either only in syntax or in some similarly minor manner between C# and Java.
- Main Method
- Inheritance Syntax
- Run Time Type Identification (is operator)
- Namespaces
- Constructors, Destructors and Finalizers
- Synchronizing Methods and Code Blocks
- Access Modifiers
- Reflection
- Declaring Constants
- Primitive Types
- Array Declarations
- Calling Base Class Constructors and Constructor Chaining
- For or is that foreach loops? - new!!!
- Metadata Annotations - new!!!
- Enumerations - new!!!
-
An Ever So Slight Feeling of Dj Vu
This section describes concepts and language features that exist in C# that are similar to those that exist in Java but with a significant difference.
- Nested classes
- Threads and Volatile Members
- Operator Overloading
- switch Statement
- Assemblies
- Collections
- goto (no longer considered harmful)
- Virtual Methods (and final ones too)
- File I/O
- Object Serialization
- Documentation Generation from Source Code Comments
- Multiple Classes in a Single File
- Importing Libraries
- Events
- Cross Language Interoperability
-
Now For Something Completely Different
This section describes language features and concepts that exist in C# and have no Java counterpart.
- Deterministic Object Cleanup
- Delegates - changed!!!
- Value Types (Structs)
- Run Time Type Identification (as operator)
- Properties - changed!!!
- Multidimensional Arrays
- Indexers
- Preprocessor Directives - changed!!!
- Aliases
- Runtime Code Generation
- Pointers and Unsafe Code
- Pass by Reference
- Verbatim Strings
- Overflow Detection
- Explicit Interface Implementation
- Friend Assemblies - new!!!
- The Global Namespace Qualifier - new!!!
- Continuations (Iterators) - new!!!
- Partial Classes - new!!!
- Anonymous Methods - new!!!
-
Wish You Were Here
This section describes language features and concepts that exist in Java and have no C# counterpart.
- Checked Exceptions
- Cross Platform Portability (Write Once, Run Anywhere)
- Extensions
- strictfp
- Dynamic Class Loading
- Interfaces That Contain Fields
- Anonymous Inner Classes
- Static Imports - new!!!