示例#1
0
 /// <summary>
 /// Converts the given object to the type of this converter, using the specified context and culture information.
 /// </summary>
 /// <param name="context">An <see cref="ITypeDescriptorContext"/> that provides a format context.</param>
 /// <param name="culture">The <see cref="System.Globalization.CultureInfo"/> to use as the current culture. </param>
 /// <param name="value">The <see cref="Object"/> to convert.</param>
 /// <returns>An <see cref="Object"/> that represents the converted value.</returns>
 /// <exception cref="ParseException">Failed parsing from string.</exception>
 public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
 {
     if (value.GetType() == typeof(string))
     {
         return(Segment.Parse((string)value));
     }
     return(base.ConvertFrom(context, culture, value));
 }