コード例 #1
0
 /// <summary>
 /// Sets the value of the property by using a <see cref="PropertyBagKey{T1,T2}"/>
 /// </summary>
 /// <typeparam name="T1">The public type of this property.</typeparam>
 /// <typeparam name="T2">The marshaling type of this property.</typeparam>
 /// <param name="propertyKey">The property key.</param>
 /// <param name="value">The value.</param>
 public void Set <T1, T2>(PropertyBagKey <T1, T2> propertyKey, T1 value)
 {
     Set(propertyKey.Name, value);
 }
コード例 #2
0
        /// <summary>
        /// Gets the value of the property by using a <see cref="PropertyBagKey{T1,T2}"/>
        /// </summary>
        /// <typeparam name="T1">The public type of this property.</typeparam>
        /// <typeparam name="T2">The marshaling type of this property.</typeparam>
        /// <param name="propertyKey">The property key.</param>
        /// <returns>Value of the property</returns>
        public T1 Get <T1, T2>(PropertyBagKey <T1, T2> propertyKey)
        {
            var value = Get(propertyKey.Name);

            return((T1)Convert.ChangeType(value, typeof(T1)));
        }