Esempio 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>
        /// datagridviewcellstyleconverter.ConvertTo&lt;int&gt;(context, culture, value);
        /// </example>
        /// </summary>
        public static T ConvertTo <T>(this DataGridViewCellStyleConverter datagridviewcellstyleconverter, System.ComponentModel.ITypeDescriptorContext context, System.Globalization.CultureInfo culture, Object value)
        {
            if (datagridviewcellstyleconverter == null)
            {
                throw new ArgumentNullException("datagridviewcellstyleconverter");
            }

            return((T)datagridviewcellstyleconverter.ConvertTo(context, culture, value, typeof(T)));
        }
Esempio 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&lt;int&gt;(value);
        /// </example>
        /// </summary>
        public static T ConvertTo <T>(this DataGridViewCellStyleConverter typeconverter, Object value)
        {
            if (typeconverter == null)
            {
                throw new ArgumentNullException("typeconverter");
            }

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