Open
Description
openedon Oct 8, 2024
To make BitArrays more user-friendly and easier to use it would be nice if you could access Bits in a BitArray with a Range-Indexer. Like this: var firstTwoBits = bitArray[..2];
Example comparison with a List:
var bitArray = new BitArray(new bool[]{true, false, false});
var firstBit = bitArray[0];
var firstTwoBits = bitArray[..2]; // doesn't work :(
var lastBit = bitArray[^1];
var list = new List<int> { 1, 2, 3 };
var firstItem = list[0];
var firstTwoItems = list[..2]; // works fine!
var lastItem = list[^1];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment