Exemplo n.º 1
0
 /// <summary>
 ///  Converts the given object to the converter's native type.
 /// </summary>
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     if (value is string)
     {
         return(com2Enum.FromString((string)value));
     }
     return(base.ConvertFrom(context, culture, value));
 }
Exemplo n.º 2
0
        /// <summary>
        ///  Converts the given object to the converter's native type.
        /// </summary>
        public override object?ConvertFrom(ITypeDescriptorContext?context, CultureInfo?culture, object value)
        {
            if (value is string valueAsString)
            {
                return(_com2Enum.FromString(valueAsString));
            }

            return(base.ConvertFrom(context, culture, value));
        }