Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我必须创建一个新bitarray的更大的现有元素(在开头多了一个元素)并将其复制到新 bitarray的.
bitarray
到目前为止我已经这样做了,但看起来很丑:
BitArray New_Ft = new BitArray(Ft.Length + 1); for (int i = 0; i <= Ft.Length - 1; i++) { New_Ft(i + 1) = Ft(i); }
有没有更聪明的方法(一些全球副本左右)?
也许您需要创建一个临时数组。没必要Byte[]可以是int[]or Bool[]。
Byte[]
int[]
Bool[]
Byte[] bits = new Byte[Ft.Length + 1]; Ft.CopyTo(bits, 0); BitArray New_Ft = new BitArray(bits);