namespace Toolkit.Foundation; public class ConfigurationValue(Func> changed) where TValue : class, new() { private TValue? currentValue; public bool TryUpdate(TConfiguration configuration, out TValue value) { TValue newValue = new(); changed(configuration).Invoke(newValue); if (!EqualityComparer.Default.Equals(currentValue, newValue)) { value = newValue; currentValue = newValue; return true; } value = currentValue!; return false; } }