Example #1
0
        /// <summary>Gets the current value of a property.</summary>
        /// <typeparam name="T">the type of the property</typeparam>
        protected T GetPropertyValue <T>(string propertyName)
        {
            if (PropertyValues.TryGetValue(propertyName, out var result))
            {
                return((T)result);
            }

            return(default(T));
        }
Example #2
0
        /// <summary>
        /// Get known values for a property
        /// </summary>
        /// <param name="property">property to retrieve values</param>
        /// <returns></returns>
        public IEnumerable <PropertyValue> GetValues(PropertyInfo property)
        {
            PropertyValue[] values;

            if (!PropertyValues.TryGetValue(property, out values))
            {
                throw new ArgumentException($"Unknown property {property}.");
            }

            return(values);
        }