Exemplo n.º 1
0
        /// <summary>
        /// Extends ConvertTo so that methods that return a specific type object given a Type parameter can be
        /// used as generic method and casting is not required.
        /// <example>
        /// extendedprotectionpolicytypeconverter.ConvertTo<int>(context, culture, value);
        /// </example>
        /// </summary>
        public static T ConvertTo <T>(this ExtendedProtectionPolicyTypeConverter extendedprotectionpolicytypeconverter, System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, Object value)
        {
            if (extendedprotectionpolicytypeconverter == null)
            {
                throw new ArgumentNullException("extendedprotectionpolicytypeconverter");
            }

            return((T)extendedprotectionpolicytypeconverter.ConvertTo(context, culture, value, typeof(T)));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Extends ConvertTo so that methods that return a specific type object given a Type parameter can be
        /// used as generic method and casting is not required.
        /// <example>
        /// typeconverter.ConvertTo<int>(value);
        /// </example>
        /// </summary>
        public static T ConvertTo <T>(this ExtendedProtectionPolicyTypeConverter typeconverter, Object value)
        {
            if (typeconverter == null)
            {
                throw new ArgumentNullException("typeconverter");
            }

            return((T)typeconverter.ConvertTo(value, typeof(T)));
        }