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

            return((T)imageindexconverter.ConvertTo(context, culture, value, typeof(T)));
        }
Ejemplo 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 ImageIndexConverter typeconverter, Object value)
        {
            if (typeconverter == null)
            {
                throw new ArgumentNullException("typeconverter");
            }

            return((T)typeconverter.ConvertTo(value, typeof(T)));
        }
Ejemplo n.º 3
0
 public ImageIndexConverterTest()
 {
     button = new ToolBarButton();
     pdc    = TypeDescriptor.GetProperties(button);
     ic     = (ImageIndexConverter)pdc.Find("ImageIndex", true).Converter;
 }