public static bool TryReplace <T>(this ApplicationDataContainer settings, string key, T value) { T original = settings.Replace(key, value); return(!(original == null && value == null || original != null && original.Equals(value))); }