unsafe public void Add(TransactionPairBinary trade) { if (count >= capacity) { throw new ApplicationException("Only " + capacity + " items allows per transaction page."); } fixed(byte *bptr = buffer) { TransactionPairBinary *tptr = (TransactionPairBinary *)bptr; *(tptr + count) = trade; } count++; }
unsafe public TransactionPairBinary this[int index] { get { CheckIndex(index); fixed(byte *bptr = buffer) { TransactionPairBinary *tptr = (TransactionPairBinary *)bptr; return(*(tptr + index)); } } set { CheckIndex(index); fixed(byte *bptr = buffer) { TransactionPairBinary *tptr = (TransactionPairBinary *)bptr; *(tptr + index) = value; } } }