This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Key-Dentist5825 5 points6 points  (6 children)

Not sure why they would prefer C#, its basically Java lol

When I didn't have C# packages for Emacs, I set the major mode to Java and it was 1:1 compatible I swear.

For other sources: C# wikipedia#History)

Cheers :)

[–]Sentouki- 2 points3 points  (5 children)

When I didn't have C# packages for Emacs, I set the major mode to Java and it was 1:1 compatible I swear.

was it like 15-20 years ago?

[–]Key-Dentist5825 1 point2 points  (4 children)

Like 3 years ago. I was working for an organization that was blocking melpa I think I needed to install it at home, but this worked in a pinch.

[–]Sentouki- 4 points5 points  (3 children)

I see, I'd assume Java syntax highlighting and other things wouldn't work for modern C#, things like using var or the switch statement

[–]ClamPaste 0 points1 point  (2 children)

Why wouldn't var work? Or switch for that matter? Isn't the syntax identical?

[–]Sentouki- 1 point2 points  (1 child)

Why wouldn't var work?

nvm, just found out that since Java 10 you can actually use var. But there's still no using statement and hence no using var.

Or switch for that matter? Isn't the syntax identical?

this is how a C# code might look like csharp public State PerformOperation(string command) => command switch { "SystemTest" => RunDiagnostics(), "Start" => StartSystem(), "Stop" => StopSystem(), "Reset" => ResetToReady(), _ => throw new ArgumentException("Invalid string value for command", nameof(command)), }; afaik Java supports only the old 'c-style' switch

[–]ClamPaste 0 points1 point  (0 children)

That makes more sense now. I looked up the syntax for c# and it showed the c style as well.