private CalculatedProperty <T> AddCalculatedProperty <T>(Func <T> calculateValue, string propertyName) { CalculatedProperty <T> result = new CalculatedProperty <T>(_onPropertyChanged, calculateValue); _properties.Add(propertyName, result); return(result); }
/// <summary> /// Retrieves the specified calculated property if it exists; otherwise, creates the calculated property and returns it. /// </summary> /// <typeparam name="T">The type of the property value.</typeparam> /// <param name="calculateValue">The delegate used to calculate the property value.</param> /// <param name="propertyName">The name of the property to retrieve or create.</param> public CalculatedProperty <T> GetOrAddCalculatedProperty <T>(Func <T> calculateValue, [CallerMemberName] string propertyName = null !) { IProperty result; if (!_properties.TryGetValue(propertyName, out result)) { result = new CalculatedProperty <T>(_onPropertyChanged, calculateValue); _properties.Add(propertyName, result); } return((CalculatedProperty <T>)result); }
public DebugView(CalculatedProperty <T> property) { _property = property; _base = new SourceProperty.DebugView(property._sourceProperty); }