public T GetValueOrDefault() { if (HasValue) { return(serializer.Deserialize(Key)); } else { return(default(T)); } }
public MemCachedPreference(string key, IPrefSerializer <T> serializer, T initialDefaultValue = default(T)) { this.key = key; this.serializer = serializer; hasValue = PlayerPrefs.HasKey(key); if (HasValue) { cache = serializer.Deserialize(key); } else { cache = initialDefaultValue; } }
public T Deserialize(string key) { var bytes = serializer.Deserialize(key); return(encoder.Decode(bytes)); }