+ 5

C# vs java

Testing C# I notice that data structures, syntax and methods are "inspired by"/"copied from" java. What are the advantages of C# over java ? Has C# extra interesting language features that java hasn't ? Or is it only a Microsoft copy of java ?

12th Jan 2020, 6:55 PM
Javier Felipe Toribio
Javier Felipe Toribio - avatar
12 ответов
+ 8
For me C# has nicer syntax overall. Async/await syntax makes asynchronous calls so much easier. With .NET core programs are truly multiplatform. Ref/in/out keywords. Linq as pointed by Tibor Santa. Better Generics. More access modifiers (internal, private protected), which give you more control over scope of your code. Public properties (no need for writing setters and getters all the time). When you wanna play with webdev you just create ASP.NET Core project and that's it, in Java you have to configure Spring like whole day. That's a few from the top of my head ^^
14th Jan 2020, 3:45 PM
Jakub Stasiak
Jakub Stasiak - avatar
+ 12
Having worked with both Java and C# since they both were released, I believe strongly that Java has failed to measure up to its potential. Compared to C# and even Kotlin, Java is an antiquated language that is only popular from its momentum caused by its earlier days and adoption in universities. To learn more about specific details, check out these two posts: https://www.sololearn.com/post/183509/ https://www.sololearn.com/post/117714/
19th Jan 2020, 4:37 AM
David Carroll
David Carroll - avatar
+ 3
Mirielle🐶 don't take it personally, and I appreciate your opinion if you can elaborate, what exactly (which features) make C# more powerful for you. Peace! :) 🤣
13th Jan 2020, 5:58 AM
Tibor Santa
Tibor Santa - avatar
+ 2
Actually both languages are spinoffs of C++ created with the intent to fix its drawbacks... Hence their syntax is very similar and so is their core toolset. Java is older and carries a lot of technical baggage, there is tons of legacy code in enterprises on old java versions that is difficult to maintain or upgrade. Now Java has become open source and more or less free from the clutches of Oracle, so it has a chance to revive and new features are added constantly. C# works best in the Microsoft world (with Windows, Azure, MSSQL etc.) but dotnet is also multiplatform now. Some say C# is very well designed and more convenient than Java, has less boilerplate code and easier management of external libs. I think it is a matter of preference :) https://www.sololearn.com/Discuss/1822811/?ref=app
12th Jan 2020, 7:35 PM
Tibor Santa
Tibor Santa - avatar
+ 2
Instead of starting a religious war over which is better (without external references), I suggest to focus on the question: does C# have any unique feature that is missing from Java? Syntax variations aside, Linq in C# is probably one of those features. It allows to talk with any enumerable type (including database records) in a uniform way, and has an SQL-like alternative syntax. Maybe Java Streams come close in functionality, but slightly less capable. If anyone knows and has used both languages extensively, they might be able to point out additional such features I overlooked...
13th Jan 2020, 5:47 AM
Tibor Santa
Tibor Santa - avatar
0
Guys .exe :)
13th Jan 2020, 3:31 PM
Flayer
Flayer - avatar
- 1
I love Java ;)
14th Jan 2020, 3:39 PM
Alex Jose Silva
Alex Jose Silva - avatar
- 2
I would say Java.
15th Jan 2020, 2:07 AM
Ashutosh Mulky
Ashutosh Mulky - avatar