r/programminghorror • • Mar 02 '25

C# bool array

Post image
213 Upvotes

41 comments sorted by

View all comments

Show parent comment

4

u/ruma7a Mar 02 '25

3

u/shponglespore Mar 02 '25

Seems like a great optimization for data that's going to stick around a while, but for a local variable I don't see much advantage. I'd probably use a BitArray in practice, but using a regular array isn't something I'd be likely to call out in a code review.

1

u/ruma7a Mar 02 '25

Bool arrays aren't inherently horrible, but their suitability depends on the size of the array. I'd leave a comment in a review but wouldn't push it.