RestImageResize/Utils/SmartConvert.cs
/// <summary>
/// Attempts to convert value to the equivalent value of specified type.
/// </summary>
/// <typeparam name="TResult">The target conversion type.</typeparam>
/// <param name="value">The value to convert.</param>
/// <param name="defaultValue">The default value of target type that should be used as empty value equivalent.</param>
/// <param name="fallbackValue">The value that should be used if source value can not be converted to target type (if not specified <paramref name="defaultValue"/> is used).</param>
/// <returns>
/// The conversion result value.
/// </returns>
Attempts to convert value to the equivalent value of specified type.
Attempts to convert value to the equivalent value of specified type .
public static TResult TryChangeType<TResult>(object value, TResult defaultValue = default(TResult), TResult fallbackValue = default(TResult))
        {
            try
            {
                return ChangeType<TResult>(value, defaultValue);
            }
            catch
            {
                return fallbackValue;
            }
        }
public static TResult TryChangeType < TResult > ( object value , TResult defaultValue = default ( TResult ) , TResult fallbackValue = default ( TResult ) ) { try { return ChangeType < TResult > ( value , defaultValue ) ; } catch { return fallbackValue ; } }
Attempts to convert value to the equivalent value of specified type.
Attempts to convert value to the equivalent value of specified type .
The conversion result value.
The conversion result value .
value
object
The value to convert.
The value to convert .
defaultValue
TResult
The default value of target type that should be used as empty value equivalent.
The default value of target type that should be used as empty value equivalent .
fallbackValue
TResult
The value that should be used if source value can not be converted to target type (if not specified  is used).
The value that should be used if source value can not be converted to target type ( if not specified is used ) .
typeparam
The target conversion type.
The target conversion type .