System.UriTypeConverter.UriTypeConverter.ConvertFrom C# (CSharp) Méthode

ConvertFrom() public méthode

public ConvertFrom ( ITypeDescriptorContext context, CultureInfo culture, object value ) : object
context ITypeDescriptorContext
culture System.Globalization.CultureInfo
value object
Résultat object
		public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
		{
			if (value == null)
				throw new ArgumentNullException ("value");

			if (!CanConvertFrom (context, value.GetType ()))
				throw new NotSupportedException (Locale.GetText ("Cannot convert from value."));

			if (value is Uri)
				return value;

			string s = (value as string);
			if (s != null)
				return new Uri (s, UriKind.RelativeOrAbsolute);
#if !NET_2_1
			InstanceDescriptor id = (value as InstanceDescriptor);
			if (id != null) {
				return id.Invoke ();
			}
#endif
			return base.ConvertFrom (context, culture, value);
		}