내가 처음에 List<BigInteger>
을 사용했습니다. 더 이상 ArrayList
은 필요 없습니다.
byte[][] allByteArrays = bigIntegersArrayList.Cast<BigInteger>()
.Select(bi => bi.ToByteArray())
.ToArray();
를 완벽을 위해서,보다 효율적으로 할 수 있습니다 LINQ없이 고전적인 방법의 경우 :
var bigIntegers = new List<System.Numerics.BigInteger>(); // fill...
byte[][] allByteArrays = bigIntegers.Select(bi => bi.ToByteArray()).ToArray();
그렇지 않으면 당신이 ArrayList
에있는 모든 개체를 캐스팅해야합니다 그럼 당신이 LINQ 쿼리를 사용할 수 있습니다 :
byte[][] allByteArrays = new byte[bigIntegers.Count][];
for (int i = 0; i < allByteArrays.Length; i++)
allByteArrays[i] = bigIntegers[i].ToByteArray();
@TimSchmelter 확인해 드리겠습니다. 그러나 그것은 나를 도와주지 않습니다 ... – user3660340