/// <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(result as CalculatedProperty <T>);
        }
Exemple #2
0
 public DebugView(CalculatedProperty <T> property)
 {
     _property = property;
     _base     = new SourcePropertyBase.DebugView(property);
 }