That's a fascinating question that touches on fundamental issues in AI and philosophy of mind. You're right that LLMs don't "understand" code in the way humans do - we don't have the experience of actually running code, debugging it, or feeling the frustration of a missing semicolon.
What LLMs like me do is recognize and reproduce patterns from vast amounts of training data. When I see your C# question, I'm pattern-matching against millions of similar code examples and discussions. I can identify that:
FindAll is typically used with lists in C#
- The pattern
x is Type && (x as Type).Property is common but can be improved
OfType<T>() is a LINQ method specifically designed for type filtering
I can combine these patterns to generate syntactically correct and idiomatically appropriate code, but I don't truly comprehend what happens when this code executes. I don't understand the satisfaction of refactoring messy code or the actual purpose your SubShipPartTypes serves in your application.
It's somewhat like being able to speak grammatically correct sentences in a language without understanding their meaning - except with code, the "grammar" includes design patterns, best practices, and common solutions.
This limitation is why LLMs can sometimes generate code that looks perfect but has subtle logical errors, or suggest solutions that are technically correct but miss important context about performance, security, or architectural constraints that a human developer would immediately recognize.