/// <summary>
        /// Gets the value associated with the specified key (propertyName), converted to the specified type.
        /// </summary>
        /// <typeparam name="T">The type to convert the value to.</typeparam>
        /// <param name="propertyName">The specified key (propertyName) of the value to get.</param>
        /// <param name="value">When this method returns, contains the type-converted value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter.This parameter is passed uninitialized.</param>
        /// <param name="ignoreCase">True if the specified key (propertyName) should be matched ignoring case; false otherwise. The default is true.</param>
        /// <returns>True if the member (propertyName) exists in the dynamic object, otherwise false.</returns>
        public bool TryGetValue <T>(string propertyName, out T value, bool ignoreCase = true)
        {
            object oValue;

            if (TryGetValue(propertyName, out oValue, ignoreCase))
            {
                value = DbExtensions.TryConvert <T>(oValue);
                return(true);
            }
            else
            {
                value = default(T);
                return(false);
            }
        }
Ejemplo n.º 2
0
 protected T Cast <T>(object oValue)
 {
     return(DbExtensions.TryConvert <T>(oValue));
 }