public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (destinationType != typeof (int) && destinationType != typeof (string))
return base.ConvertTo (context, culture, value, destinationType);
if (value is string) {
if (destinationType == typeof (int)) {
if (String.Compare ("FullyExpand", (string)value, StringComparison.OrdinalIgnoreCase) == 0)
return -1;
try {
return Int32.Parse ((string)value);
} catch (Exception) {
return -1;
}
} else
return value;
}
int val = (int)value;
if (destinationType == typeof (string)) {
if (val == -1)
return "FullyExpand";
return val.ToString ();
}
return value;
}