I'm using WPF converter and wondered in terms of performance what would be better in the following example, to use class members or local variables ?
public object Convert(object value, Type targetType, object parameter,System.Globalization.CultureInfo culture)
{
if ((int)value == 1)
return (Color)ColorConverter.ConvertFromString("#FCD44E");
return (Color)ColorConverter.ConvertFromString("#FCD44E");
}
or :
Color _color1 = (Color)ColorConverter.ConvertFromString("#FCD44E");
Color _color2 = (Color)ColorConverter.ConvertFromString("#FCD666");
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if ((int)value == 1)
return _color1;
return _color2;
}