ComponentFactory.Krypton.Toolkit.ButtonSpecFormFixedConverter.ConvertTo C# (CSharp) Method

ConvertTo() public method

Converts the given value object to the specified type, using the specified context and culture information.
public ConvertTo ( ITypeDescriptorContext context, System culture, object value, Type destinationType ) : object
context ITypeDescriptorContext An ITypeDescriptorContext that provides a format context.
culture System A CultureInfo. If a null reference (Nothing in Visual Basic) is passed, the current culture is assumed.
value object The Object to convert.
destinationType System.Type The Type to convert the value parameter to.
return object
        public override object ConvertTo(ITypeDescriptorContext context, 
                                         System.Globalization.CultureInfo culture, 
                                         object value, 
                                         Type destinationType)
        {
            // Can always convert to a string representation
            if (destinationType == typeof(string))
            {
                // Cast to correct type
                ButtonSpecFormFixed buttonSpec = (ButtonSpecFormFixed)value;

                // Ask the button spec for the correct string
                return buttonSpec.ToString();
            }

            // Let base class attempt other conversions
            return base.ConvertTo(context, culture, value, destinationType);
        }
ButtonSpecFormFixedConverter