spicyusername
a month ago
I started using C# recently for a hobby project writing a game engine on top of Monogame, and I have been very surprised at how nice of a language C# is to use.
It has a clean syntax, decent package management, and basically every language feature I regularly reach for except algebraic data types, which are probably coming eventually.
I think the association of .NET to Microsoft tarnished my expectations.
andix
a month ago
Modern C# and .NET are great. It still suffers from the bad reputation of the Windows-only .NET Framework. It's still a quite heavy platform with a lot of features, but the .NET team invested a lot of time to make it more approachable recently.
With top level Programs and file-based apps[1] it can be used as a scripting language now, just add a shebang (#!/usr/local/share/dotnet/dotnet run) to the first line and make it executable. It will still compile to a temporary file (slow on first run), but it doesn't require a build step anymore for smaller scripts.
[1]: https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals...
actionfromafar
a month ago
Also, if you compile Ahead Of Time (AOT) you can cut down on the features and get basically as small a subset as you want of the libraries. IMHO C# and dotnet are really starting to become very impressive.
olvy0
a month ago
There's also bflat [0]. Not an official Microsoft product, more of a passion project of a specific employee.
"C# as you know it but with Go-inspired tooling that produces small, selfcontained, and native executables out of the box." Really impressive. Self contained and small build system.
andix
a month ago
AOT requires a lot of fiddling around, and might break the application unexpectedly, with very weird errors. It is mostly targeted to Blazor (WASM) and for serverless functions.
The default runtime and JIT are fine for most use cases.
orphea
a month ago
> AOT requires a lot of fiddling around, and might break the application unexpectedly, with very weird errors.
It hasn't been my experience. Native AOT does come with some limitations [1][2], but nothing awful. Mostly it's that you can't generate code at runtime and you have to tame the code trimmer. Just don't ignore code analysis warnings and you should be good. > It is mostly targeted to Blazor (WASM) and for serverless functions.
Making your CLIs start fast is also a huge use case.[1]: https://learn.microsoft.com/en-us/dotnet/core/deploying/nati...
[2]: https://learn.microsoft.com/en-us/dotnet/core/deploying/trim...
actionfromafar
a month ago
C# AOT may sometimes require fiddling around, but in my experience a lot less fiddling around than what my alternative used to be, which was to use C++.
neonsunset
a month ago
[dead]
thdrtol
a month ago
I love C# and .NET and use it every day.
Sometimes I wonder if the .NET department is totally separated from the rest of Microsoft. Microsoft is so bad on all fronts I stopped using everything that has to do with it. Windows, Xbox, the Microsoft account experience, the Microsoft store, for me it has been one big trip of frustration.
andix
a month ago
Microsoft is huge, it's many companies inside one company.
.NET seems to be somewhere close to Azure, but now far away from Windows or the business applications (Office/Teams, Dynamics, Power Platform). Things like GitHub, LinkedIn or Xbox seem to be de facto separate companies.
Edit: .NET used to be tied closely to Windows, which gave it the horrible reputation. The dark age of .NET ;)
vips7L
a month ago
Unions have a proposal: https://github.com/dotnet/csharplang/issues/9662