From Java to C#

10:10

Expert Member
Joined
Oct 9, 2022
Messages
1,696
Reaction score
830
Location
Ogies Mpumalanga
I love Java, it is a good language, and it feels very formal structural and my brain just is in its happy place.

Problem Unity works with C-sharp and I want to die...


1678296232104.png

I will work with it, it is not that bad, but now I have to use Visual Studio... Well technically I don't but for the sake of simplification I just decided to go with it.

I guess this is a rant/observation.

Now for the real stuff, C# isn't much different to Java, I found... Maybe I am not on a level yet that it becomes phenomenally different, but to anyone jumping ship from Java to C# it is ugly, but you can code with it...

If you are used to IntelliJ, then Visual Studio feels like it is overcomplicating life, the matrix and everything good in the world. But I got use to it, so if you have to jump ship, it took me a few hours to figure out why Visual Studio is the way it is.

Truthfully, it wasn't that big of a jump. It works, it does what it is supposed to do.


Just get Eye Gene, it makes life better...
You will thank me later...


 
Last edited:
C# syntax and sugar is light years ahead of Java.
I have done multiple years of Java from Spring 2.7 to Spring 5.
The best decision I ever made was ditching Java in our company in favor of modern C# + .NET.


If you are used to IntelliJ, use Rider. I never use VS or VS Code for C#
 
Was also going to say, use Rider.
Modern C# (.Net 6) is pretty decent, basically only prefer how streamable is implemented in Java, else find most things in C# better.
 
I'm trying to think of one relevant thing Java does better than C#. I'm sure there's more but I can only think of enums.

Actually had a thought the other day when I looked at the latest C#... why would I bother with Go?
 
I'm trying to think of one relevant thing Java does better than C#. I'm sure there's more but I can only think of enums.

Actually had a thought the other day when I looked at the latest C#... why would I bother with Go?
Go for me has always been "better" handling of errors (some reason in some projects, C# people shoehorn result object because "performance"), and green threads (co-routines). If I needed to spin up something quickly that's parallel, I'll probably still pick it, but with the new minimal API in C#, I've used it for my last two hobby projects instead.

Also Go forces simplicity, that can be great that you don't get someone doing something weird and wonderful (*cough* LINQ IQueryables *cough*), and the ability to directly just say "this github project is my dependency" is both great and terrible (love for hobby, would hate in business).

Also sad that async Task doesn't have support for out/ref params, really like them in C#, now have the giant Tuples.
 
I love Java, it is a good language, and it feels very formal structural and my brain just is in its happy place.

Problem Unity works with C-sharp and I want to die...


View attachment 1489325

I will work with it, it is not that bad, but now I have to use Visual Studio... Well technically I don't but for the sake of simplification I just decided to go with it.

I guess this is a rant/observation.

Now for the real stuff, C# isn't much different to Java, I found... Maybe I am not on a level yet that it becomes phenomenally different, but to anyone jumping ship from Java to C# it is ugly, but you can code with it...

If you are used to IntelliJ, then Visual Studio feels like it is overcomplicating life, the matrix and everything good in the world. But I got use to it, so if you have to jump ship, it took me a few hours to figure out why Visual Studio is the way it is.
Truthfully, it wasn't that big of a jump. It works, it does what it is supposed to do.


Just get Eye Gene, it makes life better...
You will thank me later...



Haha, you can code in VSCode as well, but Visual Studio works great. Since it's Unity you don't even really compile in VS, Unity does all of that by itself (the only exception would be when debugging and attaching to the Editor).

Following up on that, its a game engine, so you skip the majority of C# heavy code during runtime, you are only really allowed to use things like LINQ etc. at startup, due to the garbage it creates and so you're back to the generic for loops etc. that all languages use.
 
Go for me has always been "better" handling of errors (some reason in some projects, C# people shoehorn result object because "performance"), and green threads (co-routines). If I needed to spin up something quickly that's parallel, I'll probably still pick it, but with the new minimal API in C#, I've used it for my last two hobby projects instead.

Also Go forces simplicity, that can be great that you don't get someone doing something weird and wonderful (*cough* LINQ IQueryables *cough*), and the ability to directly just say "this github project is my dependency" is both great and terrible (love for hobby, would hate in business).

Also sad that async Task doesn't have support for out/ref params, really like them in C#, now have the giant Tuples.

Yeah, being able to say that function returns a result, or an error, is flipping great.

Discriminated unions are coming to C#, but unfortunately that aren't going to make it to C# 12 from what I can see.

I am however using the `ErrorOr` package, which does get my halfway there, and does "enforce" exhaustive matching (you can obviously eject and do an unsafe call like `result.Value.someProperty`)
 
C# syntax and sugar is light years ahead of Java.
I have done multiple years of Java from Spring 2.7 to Spring 5.
The best decision I ever made was ditching Java in our company in favor of modern C# + .NET.


If you are used to IntelliJ, use Rider. I never use VS or VS Code for C#
I don't know Rider, but I will look into it. The only reason why I am keeping with Visual Studio is my course is based on it. So for the sake of simplicity, I will be running with VS for now.
 
If you don’t like C#, you’re doing it wrong...
C# has real limitations in regard to platform support, and I am told by my lecturer that it has limited low-level support. Java is much better with memory allocation as well. His words, not mine.

Personally, I like the idea to work in multiple languages, it is good practice.
 
I'm trying to think of one relevant thing Java does better than C#. I'm sure there's more but I can only think of enums.

Actually had a thought the other day when I looked at the latest C#... why would I bother with Go?
Java Streams are pretty nice!
 
C# has real limitations in regard to platform support, and I am told by my lecturer that it has limited low-level support. Java is much better with memory allocation as well. His words, not mine.

Personally, I like the idea to work in multiple languages, it is good practice.

Being brutal here, your lecturing is talking out his ass :D

C# supports exactly the same amount of platforms that Java does - the CLR (Java has the JVM) (ignoring AOT).
The CLR (and the JVM), run in EVERY popular platform (Windows, Linux, MacOS; with x86, x64 or arm64).

It's possible/likely that your lecturer is out of date with the current (2016+) state of C#, which is fine (.NET Framework supports windows only, ignoring Mono, but no sane person starts a new project using .NET Framework)

not exactly sure what "limited low-level support" means, so cannot really comment there.

As with everything, there is no "best", just the "best for you/your situation"
 
Last edited:
C# has real limitations in regard to platform support, and I am told by my lecturer that it has limited low-level support. Java is much better with memory allocation as well. His words, not mine.

Personally, I like the idea to work in multiple languages, it is good practice.

Yeah.. your lecturer is talking kuk.
 
Being brutal here, your lecturing is talking out his ass :D

C# supports exactly the same amount of platforms that Java does - the CLR (Java has the JVM) (ignoring AOT).
The CLR (and the JVM), run in EVERY popular platform (Windows, Linux, MacOS; with x86, x64 or arm64).

It's possible/likely that your lecturer is out of date with the current (2016+) state of C#, which is fine (.NET Framework supports windows only, ignoring Mono, but no sane person starts a new project using .NET Framework)

not exactly sure what "limited low-level support" means, so cannot really comment there.

As with everything, there is no "best", just the "best for you/your situation"
I started with Java, so it will always be the favourite child. But it is not about what language or what IDE. It is about getting the job done. I HATE Kotlin and Google should be shot for adopting it, but it is what it is. I can work with it, Java, and a few others. C# and C++ i mean rust took few days. But I think the language wars is kinda stupid but also not because sometimes things just make my eyes bleed...
 
I
Granted I haven't done real Java work since 2018, but how are they "better" than C# LINQ/extension methods?
I honestly can't say that it's "better" or "worse". Java streams were only released with Java 8 and Linq was added to C# yonks ago giving it the maturity edge maybe.

I have worked as a C# dev and now lately Java and to me the 2 are pretty much the same. Both have similar syntax, both have their preferred IDEs, and both are fine for web/API/desktop/app development, both can integrate with message brokers like RabbitMQ, you can use OOP or even Functional in both. If I moved from one team that uses java to another that uses C# and vice versa It really won't matter all that much to me.

Yeah, there was a time Java lagged behind because of the whole Sun/Oracle thing but these days it's not that much different in terms of what you can achieve with it.
 
I

I honestly can't say that it's "better" or "worse". Java streams were only released with Java 8 and Linq was added to C# yonks ago giving it the maturity edge maybe.

I have worked as a C# dev and now lately Java and to me the 2 are pretty much the same. Both have similar syntax, both have their preferred IDEs, and both are fine for web/API/desktop/app development, both can integrate with message brokers like RabbitMQ, you can use OOP or even Functional in both. If I moved from one team that uses java to another that uses C# and vice versa It really won't matter all that much to me.

Yeah, there was a time Java lagged behind because of the whole Sun/Oracle thing but these days it's not that much different in terms of what you can achieve with it.
My thoughts as well, it felt mostly the same for me, but sadly Unity doesn't accept raw Java, and it has a lot of its own stuff it uses with C#. But Kotlin and C# feels almost identical, the syntax is very similar but not the same. That said, if you can do Java you can do Kotlin just fine, don't let people BS you.
 
My thoughts as well, it felt mostly the same for me, but sadly Unity doesn't accept raw Java, and it has a lot of its own stuff it uses with C#. But Kotlin and C# feels almost identical, the syntax is very similar but not the same. That said, if you can do Java you can do Kotlin just fine, don't let people BS you.

Wait until you see Dart - it looks like all the languages.
 
C# has real limitations in regard to platform support, and I am told by my lecturer that it has limited low-level support. Java is much better with memory allocation as well. His words, not mine.

Personally, I like the idea to work in multiple languages, it is good practice.
C# with .NET Core is probebly the most widely supported. C# is the language that can do more than any other language. I suspect you suffer from anti-Microsoft romance.

It is a great advatage of C# that it can do more than any other language. Azure is the cloud that supports the most languages, but if you know C# then you can do more faster.

It is not good practice to have to use multiple languages. I did do Java at 1st and switched to C#. I found C# to be easier and superior.
 
Top
Sign up to the MyBroadband newsletter
X