Ejemplo n.º 1
0
 /// <summary>
 /// Converts the value to the given Type using the given CultureInfo and the given <see cref="ConversionOptions">ConversionOptions</see>.
 /// A return value indicates whether the operation succeeded.
 /// </summary>
 /// <param name="value">The value which is converted.</param>
 /// <param name="destinationType">The Type to which the given value is converted.</param>
 /// <param name="result">An Object instance of type <paramref name="destinationType">destinationType</paramref> whose value is equivalent to the given <paramref name="value">value</paramref> if the operation succeeded.</param>
 /// <param name="culture">The CultureInfo to use as the current culture.</param>
 /// <param name="options">The options which are used for conversion.</param>
 /// <returns>true if <paramref name="value"/> was converted successfully; otherwise, false.</returns>
 public static bool TryConvert(this object value, Type destinationType, out object result, CultureInfo culture, ConversionOptions options)
 {
     return(UniversalTypeConverter.TryConvert(value, destinationType, out result, culture, options));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Converts the value to the given Type using the current CultureInfo and the <see cref="ConversionOptions">ConversionOptions</see>.<see cref="ConversionOptions.EnhancedTypicalValues">ConvertSpecialValues</see>.
 /// A return value indicates whether the operation succeeded.
 /// </summary>
 /// <param name="value">The value which is converted.</param>
 /// <param name="destinationType">The Type to which the given value is converted.</param>
 /// <param name="result">An Object instance of type <paramref name="destinationType">destinationType</paramref> whose value is equivalent to the given <paramref name="value">value</paramref> if the operation succeeded.</param>
 /// <returns>true if <paramref name="value"/> was converted successfully; otherwise, false.</returns>
 public static bool TryConvert(this object value, Type destinationType, out object result)
 {
     return(UniversalTypeConverter.TryConvert(value, destinationType, out result));
 }