System.BitArray only implements a universal IEnumerable that returns an object for the IEnumerator.Current property. Does foreach run on top of BitArray - for example
foreach (bool b in bitArray) { // ... }
and delete all the values of each bit?
Looking at the bitarray enumerator in the reflector, it looks like it makes a new bitmask with every call to MoveNext (), and not something smarter. Is there a more efficient way to enumerate BitArray or replace BitArray with the same storage characteristics? (List <bool> etc. Uses one byte per bool, not one bit, so uses 8x as much space)
, . , . , , / ( , , , ). , , , .
, ... , , "". :
public static IEnumerable<bool> EnumerateBitArray(BitArray bitArray) { for (int i=0; i < bitArray.Length; i++) { yield return bitArray[i]; } }
, - !
Source: https://habr.com/ru/post/1712663/More articles:remove index.php from cakephp url - friendly-urlПреобразование объявления в javascript ActiveXObject - javascriptCreating thumbnails from swf file in php? - phpHow to check if a private method has been called with the expected argument in unit test? - c #Portable way to determine total disk size in Java (pre java 6) - java"order by" taking too long in mysql - mysqlDisallow calling public constructors except XML serializer - c #library for sending trackbacks / pingbacks in php - trackbackПроблема с Javascript - javascriptWPF / C #: disable drag and drop for text fields? - c #All Articles