public static byte[] ToBytes(this PerformanceMould mould)
 {
     using (var memoryStream = new MemoryStream())
     {
         new BinaryFormatter().Serialize(memoryStream, mould);
         return(memoryStream.ToArray());
     }
 }
        public static void Save(string key, PerformanceMould mould)
        {
            if (!Cache.ContainsKey(key))
            {
                Cache.Add(key, null);
            }

            Cache[key] = mould;
        }
        public static void ToJson(this PerformanceMould mould, Stream stream)
        {
            var jsonSerializer = new DataContractJsonSerializer(typeof(PerformanceMould));

            jsonSerializer.WriteObject(stream, mould);
        }