예제 #1
0
 public static byte[] Serialize(NCacheSessionData sessionData)
 {
     using (var stream = new MemoryStream())
     {
         using (var writer = new CompactBinaryWriter(stream))
         {
             SerializationUtility.SerializeDictionary(sessionData.Items, writer);
         }
         return(stream.GetBuffer());
     }
 }
예제 #2
0
        public static NCacheSessionData Deserialize(byte[] data)
        {
            NCacheSessionData sessionData = new NCacheSessionData();

            using (var stream = new MemoryStream(data))
            {
                using (var reader = new CompactBinaryReader(stream))
                {
                    sessionData.Items = SerializationUtility.DeserializeDictionary <string, byte[]>(reader);
                }
            }
            return(sessionData);
        }