public byte[] ToBytes()
{
List<byte> encodeBuffer = new List<byte>();
RdpbcgrEncoder.EncodeStructure(encodeBuffer, (ushort)capabilitySetType);
RdpbcgrEncoder.EncodeStructure(encodeBuffer, lengthCapability);
RdpbcgrEncoder.EncodeStructure(encodeBuffer, (ushort)CacheFlags);
RdpbcgrEncoder.EncodeStructure(encodeBuffer, pad2);
RdpbcgrEncoder.EncodeStructure(encodeBuffer, NumCellCaches);
RdpbcgrEncoder.EncodeStructure(encodeBuffer, BitmapCache1CellInfo);
RdpbcgrEncoder.EncodeStructure(encodeBuffer, BitmapCache2CellInfo);
RdpbcgrEncoder.EncodeStructure(encodeBuffer, BitmapCache3CellInfo);
RdpbcgrEncoder.EncodeStructure(encodeBuffer, BitmapCache4CellInfo);
RdpbcgrEncoder.EncodeStructure(encodeBuffer, BitmapCache5CellInfo);
RdpbcgrEncoder.EncodeBytes(encodeBuffer, Pad3);
return encodeBuffer.ToArray();
}