BitsetsNET.RLEBitset.ToBitArray C# (CSharp) Method

ToBitArray() public method

Returns the contents of this set as a bit array where the value is set to true for each index that is a member of this set
public ToBitArray ( ) : BitArray
return System.Collections.BitArray
        public BitArray ToBitArray()
        {
            int arrayLength = 0;
            if (this.runArray.Count > 0)
            {
                arrayLength = this.runArray.Last().EndIndex + 1;
            }

            BitArray rtnVal = new BitArray(arrayLength, false);

            foreach (Run r in this.runArray)
            {
                for (int i = r.StartIndex; i < r.EndIndex + 1; i++)
                {
                    rtnVal[i] = true;
                }
            }

            return rtnVal;
        }