public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (!CanConvertTo (context, destinationType))
throw new NotSupportedException (Locale.GetText ("Cannot convert to destination type."));
Uri uri = (value as Uri);
if (uri != null) {
if (destinationType == typeof (string))
return uri.ToString ();
if (destinationType == typeof (Uri))
return uri;
#if !NET_2_1
if (destinationType == typeof (InstanceDescriptor)) {
ConstructorInfo ci = typeof (Uri).GetConstructor (new Type [2] { typeof (string), typeof (UriKind) });
return new InstanceDescriptor (ci , new object [] { uri.ToString (), uri.IsAbsoluteUri ? UriKind.Absolute : UriKind.Relative });
}
#endif
}
return base.ConvertTo (context, culture, value, destinationType);
}