Skip to content

Instantly share code, notes, and snippets.



Last active Sep 2, 2020
What would you like to do?
public void Indexer()
BitArray b = 10;
Assert.AreEqual(false, b[0]);
Assert.AreEqual(true, b[1]);
Assert.AreEqual(false, b[2]);
Assert.AreEqual(true, b[3]);
Assert.AreEqual(false, b[4]);
Assert.AreEqual(false, b[5]);
Assert.AreEqual(false, b[^27]); // Index
Assert.AreEqual(10, (int)b);
b[5] = true;
Assert.AreEqual(true, b[5]);
Assert.AreEqual(true, b[^27]); // Index
Assert.AreEqual(42, (int)b);
public void Initializer()
var b = new BitArray
[3] = true,
[6] = true,
Assert.AreEqual(72, b.Value);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment