I was surprised when exception error I was hitting using (double)value got fixed by changing it to System.Convert.ToDouble(value).
The value was object type.
Can anyone tell me why?
Here I attach the code and error message:
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return (double)value * (double)parameter;
}
Error Message: System.InvalidCastException: Specified cast is not valid.