4 ms·
> far from idiomatic C# as to be almost indistinguishable from C C# could be much nicer to write than C. "Low-level" C# is still idiomatic, even if you use mem
by neonsunset 1y ago
> far from idiomatic C# as to be almost indistinguishable from C
C# could be much nicer to write than C. "Low-level" C# is still idiomatic, even if you use memory-safe constructs i.e. Span<T> and friends.
There is nothing wrong with writing C# that has structs, ref Ts and not a single class.
At work, I have ported a certain C dependency to C# to fix long-standing bugs, get rid of C build systems and portability problems and gain 2-10x performance improvement (by fixing suboptimal data structure use and switching to text scanning with SearchValues<char> which is heavily vectorized).
The end result is still idiomatic and arguably easier to read. But yes, it looks very different to the average enterprise codebase.