For all the harping on if/elseif/elseif statements people do, I feel obliged to point out that just changing it to a C# switch statement might not even
do anything performance-wise.
View attachment 1357413
If the cases are all integers that are "close enough" together, the compiler can emit a jump table, but in the general case a switch statement will still be encoded in MSIL/assembler/whatever as a bunch of if-else instructions. And if the cases
aren't integers it'll have to be if/else under the hood just like it would be in C.
In fact, it wouldn't surprise me if the original source code
did use switch statements, which compiled down to if/else, and that's what you see when you decompile it. That would also explain why the Youtube guy did find a couple of switch statements in the code - the ones that use the actual MSIL "switch" opcode for a jump table decompile back into C# switch statements and the rest don't. Someone with more experience with decompilers can probably fact-check me on this.
Point being: this code needs a redesign of the data structures, not just prettying up.