A More Functional Approach
by in CodeSOD on 2021-05-27In functional programming languages, you'll frequently see some variation of the car
/cdr
operations from LISP. Given a list, these functions can split it into the head (or first element) of the list, and the tail (the rest of the list). This is often used to traverse a list recursively: function f
performs an operation on the head of the list, and then recursively calls f
on the tail of the list.
I bring this up because we're talking about C# today. C# has plenty of fun functional programming features, and you can certainly use them to write very clean, comprehensible code. Or, like Nico's co-worker, you could do something like this.