public void Deserialize(MySpace.Common.IO.IPrimitiveReader reader, int version)
        {
            using (reader.CreateRegion())
            {
                //IndexExists
                indexExists = reader.ReadBoolean();

                //IndexSize
                indexSize = reader.ReadInt32();

                //Metadata
                ushort len = reader.ReadUInt16();
                if (len > 0)
                {
                    metadata = reader.ReadBytes(len);
                }

                //ResultItemList
                int listCount = reader.ReadInt32();
                resultItemList = new List<ResultItem>(listCount);
                if (listCount > 0)
                {
                    ResultItem resultItem;
                    for (int i = 0; i < listCount; i++)
                    {
                        resultItem = new ResultItem();
                        resultItem.Deserialize(reader);
                        resultItemList.Add(resultItem);
                    }
                }

                //ExceptionInfo
                exceptionInfo = reader.ReadString();

                //VirtualCount
                virtualCount = reader.ReadInt32();
            }
        }
        public void Serialize(MySpace.Common.IO.IPrimitiveWriter writer)
        {
            using (writer.CreateRegion())
            {
                //IndexExists
                writer.Write(indexExists);

                //IndexSize
                writer.Write(indexSize);

                //Metadata
                if (metadata == null || metadata.Length == 0)
                {
                    writer.Write((ushort) 0);
                }
                else
                {
                    writer.Write((ushort) metadata.Length);
                    writer.Write(metadata);
                }

                //ResultItemList
                if (resultItemList == null || resultItemList.Count == 0)
                {
                    writer.Write(0);
                }
                else
                {
                    writer.Write(resultItemList.Count);
                    foreach (ResultItem resultItem in resultItemList)
                    {
                        resultItem.Serialize(writer);
                    }
                }

                //ExceptionInfo
                writer.Write(exceptionInfo);

                //VirtualCount
                writer.Write(virtualCount);
            }
        }