This simple snippet shows a manual way to do it. The value of bitArray[0]
is overwritten:
//... bitArray is the BitArray instance
for (int i = 1; i < bitArray.Count; i++)
{
bitArray[i - 1] = bitArray[i];
}
bitArray[bitArray.Count - 1] = false // or true, whatever you want to shift in
Making this an extension method shouldn't be a big deal.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…