Array containing only 0 and 1 values
I need an array which will only contain the values 0 and 1. Will bool be good enough for me? Or is there something lighter weight?
I dont have memory constraints but that array is made and passes online All The Time with big files passes concurrently with that array. I want the maximun optimization so the big files wont be delayed
A bool is probably not the best way to do it. Depends how many numbers you have got.
It is important to realise that even though a bool is a single bit, it requires a full byte in memory.
A BitArray on the other hand takes care of this for you and is more space efficient, although ever so slightly less time efficient. http://msdn.microsoft.com/en-us/library/system.collections.bitarray.aspx
Depends on your constraints, if it is not for a constrained environment a bool array will work just fine.