示例#1
0
 public byte[] ToBytes()
 {
     byte[] blockHashBytes    = BlockHash.ToBytes();
     byte[] filterBytes       = Filter is null ? new byte[0] : Filter.ToBytes();
     byte[] filterLengthBytes = BitConverter.GetBytes(filterBytes.Length);
     byte[] buffer            = new byte[blockHashBytes.Length + filterLengthBytes.Length + filterBytes.Length];
     Buffer.BlockCopy(blockHashBytes, 0, buffer, 0, blockHashBytes.Length);
     Buffer.BlockCopy(filterLengthBytes, 0, buffer, blockHashBytes.Length, filterLengthBytes.Length);
     Buffer.BlockCopy(filterBytes, 0, buffer, blockHashBytes.Length + filterLengthBytes.Length, filterBytes.Length);
     return(buffer);
 }