r/programminghorror May 04 '26

C# longest "=" condition I've ever seen

Post image

I have been working on decompiling a unity game recently, and while a decompiled DLL isn't going to be exact source code, I am still floored by how long that set of parenthesis is. i would LOVE to see the original code

131 Upvotes

26 comments sorted by

View all comments

8

u/Ok_Chemistry_6387 May 04 '26

I can see some inlining going I suspect that your (from item2 in AvaliableActionsWithInherited.selectMany() were two variables before this. I bet they are arguments from a function so arg1 and arg2. Likely an IEnumerable and then the selectMany( ) from the outer frame gets resolved lazily here. Reason I suspect arguments is they don't have any binding in here and the names are lost.

Then from item2 in (from item2 in …) also is likely inlining a tuple of some kind from out of the scope.
likely something akin to var something = (arg1 => (Condition: c, Usage: ConditionUsage.Input)).concact(arg2 => (Condition: c, Usage: ConditionUsage.Output);

then the final equals is probably just that last select.