C# is a pretty cool language. It is made by Microsoft, and is run within a sort-of virtual machine called the Common Language Runtime (CLR for short). I don’t want this post to be about learning C# though, I wanted to talk about where C# sprouted from.
If you know Java, you will probably be able to learn C# pretty easily. It has garbage collection and is overall pretty similar to Java. Being that Java was released in 1995 and C# was released in 2002, was C# basically just Microsoft making their own version of Java? Well, as it turns out, the short answer is yes.
As many people know, Java is used a lot, primarily for its cross-platform capabilities and ease of learning. Java in the early stages was made by Sun Microsystems. The way that Sun was able to get Java to work on several operating systems is that each company made their own version of Java for their own system. So Microsoft made the Windows version, and Apple made the Mac version. Each one of them signed a contract saying that they’d follow Sun’s values as well.
In 1997, Microsoft decided that they would add some extra features to Java to make it work better on Windows. Then, they made apps that would use these extra features, and then label their apps as “Java compatible” (Note that the apps aren’t actually Java compatible as they didn’t work on other systems, which is a core value of programming with Java). Sun then filed a lawsuit for a whopping $35 million, saying that Microsoft had breached the contract by making certain Java features work on their operating system that wouldn’t work on others. Sun ended up winning the lawsuit, and Microsoft was no longer able to use their beloved extra features.
So what was Microsoft’s next move, you may ask? They decided that they would make their own language. It would run through the .NET Framework, and be similar to Java, but with a nice touch of C++.
Now, C# and Java have parted paths significantly. C# is still run by Microsoft, and Java has changed owners from Sun to Oracle. Java still remains quite a simple language which makes it easier to read and understand, while C# has become very feature-heavy, which can be difficult for beginners to read. Both languages are still very similar though when it comes down to the code, although each language has different preferred styling.
But to answer the initial question, yes. C# was originally based on Java, and was made because Sun didn’t let Microsoft implement Windows-specific features to the Java language.