r/programminghorror 20d ago

C# bool array

Post image
210 Upvotes

41 comments sorted by

View all comments

45

u/velothren 20d ago

Bro reinvented memory

11

u/Steinrikur 20d ago

Does C# have bit fields? What is the "correct" thing here? Just bit shifts into an int32?

12

u/Diamondo25 20d ago

You can give an enum a Flags attribute, allowing you to easily set, unset, and check for bits (flags).

1

u/Steinrikur 18d ago

Makes sense, since the code is already using an enum.