4 ms·
Background: I touched C# a little over 5 years ago writing ASP.NET MVC + jQuery apps and decided I hated it then. About 6 months ago I had a side project where
by gavinray 5y ago
Background: I touched C# a little over 5 years ago writing ASP.NET MVC + jQuery apps and decided I hated it then.
About 6 months ago I had a side project where I took a C++ library and decided I'd try to translate it into every language that supports C/C++ Interop, to have a canonical "C Interop reference + comparison" repo for anyone interested
I found out that C# could do this, and started looking into how.
Long story short, it's now possible to use C# and .NET to directly interop with C/C++. Function Pointers, structs and all. You can publish a binary or static/dynamic library for any platform that's natively compiled -- zero dependencies.
It allows you to manually allocate memory and provide allocation strategies. Shit, you can even turn the GC off entirely (at this point the language is very barebones).
See ZeroSharp by same author:
https://github.com/MichalStrehovsky/zerosharp https://github.com/MichalStrehovsky/zerosharp
So on top of this surprising viability for fairly low-level or native programming, it's also:
- Just generally good at everything/bad at nothing
- Blazingly performant, and getting faster consistently. Both at a language/computation level, and for things like web servers. ASP .NET Core Kestrel webserver has throughput only topped by a handful of Rust/C++ libs, and most recent preview included a new functional router API that increased throughout by +100,000rps.
- C# as a language is evolving rapidly and has already become a solid multi paradigm lang. Adopting FP functional features like pattern matching and lambdas. It has LINQ. It's actually pleasant to write now and doesn't always feel like verbose enterprise garbage. (I prefer modeling entities as classes/structs + using pure functions for working with them)
- The tooling and ecosystem of C# and .NET are rivaled only by the JVM. The developer experience and quality/depth of libraries available are fantastic.
There's more but that's off the top of my head.
Needless to say the last few months visiting C# and .NET land have changed my former opinion.
- paavohtl 5y ago> Long story short, it's now possible to use C# and .NET to directly interop with C/C++. Function Pointers, structs and all. Note that this has always been possible - good native interop has been one the design goals from day 1. But recent features have definitely made native interop much nicer.