public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == typeof(string))
     {
         TypeAndName name = new TypeAndName((Type) value);
         return base.ConvertTo(context, culture, name, destinationType);
     }
     return base.ConvertTo(context, culture, value, destinationType);
 }
Exemple #2
0
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == typeof(string))
     {
         TypeAndName name = new TypeAndName((Type)value);
         return(base.ConvertTo(context, culture, name, destinationType));
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
Exemple #3
0
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     if (value is string)
     {
         TypeAndName name = (TypeAndName)base.ConvertFrom(context, culture, value);
         return(name.type);
     }
     return(base.ConvertFrom(context, culture, value));
 }
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(string))
            {
                TypeAndName castedValue = (TypeAndName)value;
                return(castedValue.name == null ? castedValue.type.AssemblyQualifiedName : castedValue.name);
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (!(destinationType == typeof(string)))
            {
                return(base.ConvertTo(context, culture, value, destinationType));
            }
            TypeAndName name = (TypeAndName)value;

            if (name.name != null)
            {
                return(name.name);
            }
            return(name.type.AssemblyQualifiedName);
        }