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()); } }
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); }