DEV Community

Discussion on: 5 (Extreme) Performance Tips in C# 🔥

Collapse
 
semidewi profile image
Semidewi

You could get rid of the multiplication by defining a array with length 2.

First entry at Index 0 is 0
Second entry at index 1 is -1

Instead of multiplying value by 1 or 0, you could simply do a Bitwise AND Operation with the value at Index 1 or 0.

Some comments have been hidden by the post's author - find out more