Пример #1
0
        /// <summary>
        /// Overridden <see cref="TypeConverter.ConvertTo(ITypeDescriptorContext,CultureInfo,object,Type)"/>
        /// </summary>
        /// <param name="context">An <see cref="ITypeDescriptorContext"/> that
        /// provides a format context.</param>
        /// <param name="culture">A <see cref="CultureInfo"/>. If a null reference
        /// is passed, the current culture is assumed.</param>
        /// <param name="value">The <see cref="Object"/> to convert.</param>
        /// <param name="destinationType">The <see cref="Type"/> to convert the
        /// <strong>value</strong> parameter to.</param>
        /// <returns>An <strong>Object</strong> that represents the converted value.
        /// In this implementation that is a <see cref="string"/>.</returns>
        public override object ConvertTo(
            ITypeDescriptorContext context,
            CultureInfo culture,
            object value,
            Type destinationType)
        {
            if (destinationType == typeof(string) && value is StopCondition)
            {
                StopCondition stopCondition = (StopCondition)value;
                return(stopCondition.ToString());
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }