I woke up in the middle of the night last night, thinking,
public object Convert(object value, Type targetType, object parameter, string language)
{
var scale = GetScale(parameter);
//if (value is int) return (int)value * scale;
//if (value is long) return (long)value * scale;
//if (value is float) return (float)value * scale;
//if (value is double) return (double)value * scale;
//if (value is decimal) return (decimal)value * (decimal)scale;
//return value;
return (dynamic)value * scale
}
I mean, ok this isn't the best example (although on the other hand, if I'd been writing it out properly, that would be over 20 lines of code I just replaced, which is always good for morale), but the point is I could have been doing multiple dispatch in C# for going-on 5 years now, I'm just an idiot.
Now all I need is a (stringy) type that does javascript-like type conversion, for ease of xaml.