public static byte[] Serialize(KeyedDataLibrary Library)
 {
     byte[] Buffer = null;
     if (Library != null)
     {
         BinaryFormatter bf = new BinaryFormatter();
         MemoryStream    ms = new MemoryStream();
         bf.Serialize(ms, Library);
         Buffer = ms.ToArray();
         ms.Dispose();
     }
     return(Buffer);
 }
        public static KeyedDataLibrary Deserialize(byte[] Buffer)
        {
            KeyedDataLibrary Library = null;

            if (Buffer != null && Buffer.Length > 0)
            {
                BinaryFormatter bf = new BinaryFormatter();
                MemoryStream    ms = new MemoryStream(Buffer);
                Library = bf.Deserialize(ms) as KeyedDataLibrary;
                ms.Dispose();
            }

            if (Library != null)
            {
                Library.isIndexed = false;
                Library.BuildIndex();
            }

            return(Library);
        }