Ejemplo n.º 1
0
 public static bool TryRead <T>(this ApplicationDataContainer container, string key, out T value, bool decompress = true, Services.Serialization.ISerializationService serializer = null)
 {
     if (!container.Values.ContainsKey(key))
     {
         value = default(T);
         return(false);
     }
     try
     {
         var result = container.Values[key]?.ToString();
         result     = decompress ? result.Decompress() : result;
         serializer = serializer ?? GetDefaultSerializer();
         value      = serializer.Deserialize <T>(result);
         return(true);
     }
     catch
     {
         value = default(T);
         return(false);
     }
 }
Ejemplo n.º 2
0
 private object Deserialize(string value) => _SerializationService.Deserialize(value);