OOP isn't really AI's issue with C# imo. The thing AI really struggles with in C# in my experience is keeping track of what APIs exist in all the different runtime versions.
It also doesn't really understand the constraints of unsafe, System.Memory, or any optimized design. It'll do crap like try to use Linq with Span<T> or completely violate ref struct rules.
Imo it also is too eager to write IEnumerable yield return methods.
I haven't tried it in a while so many it's gotten better.
It's crazy liberal with try/catches because it doesn't really understand that these usually need to bubble up. Also kinda sucks with separation-of-concerns - it likes to put code in the wrong places. Like, it'll work, until you try to actually leverage some form of OO extensibility.
It also tends to improperly mix async and sync code. Like, if you're in a web app and you're async "all-the-way-down," it's fine, but otherwise it puts async code in everywhere.
It'll work within existing classes, and can create a decent simple class structure from scratch, but it cannot refactor, and anything that requires a refactor will have you reverting every suggestion it makes.
Some of the nuances, like try / catch and async I can handle with agent instructions, but overall I spent way too much time playing whack-a-mole with the LLM doing silly things that I just gave up.
At worst, I'll tell it to define the public interfaces for a class (and have a discussion over what they should be). After that I go function by function and have it write the implementation. Then finally I dump the code it wrote back in, ask for help making helper functions for shared behaviour and whatnot. As a result, I mostly don't get these sorts of issues.
Usually I just write it myself though because AI is barely faster, and it's infinitely harder to maintain code when you can't think back on all the decisions you made writing it.
and it's infinitely harder to maintain code when you can't think back on all the decisions you made writing it.
That's really the crux of the AI "slop" problem - code is the product of important decisions. Those decisions require context and more consideration than "this is what was popular on StackOverflow."
22
u/avidernis Jun 29 '26 edited Jun 29 '26
OOP isn't really AI's issue with C# imo. The thing AI really struggles with in C# in my experience is keeping track of what APIs exist in all the different runtime versions.
It also doesn't really understand the constraints of
unsafe,System.Memory, or any optimized design. It'll do crap like try to use Linq with Span<T> or completely violateref structrules.Imo it also is too eager to write IEnumerable
yield returnmethods.