I have been consistently using Singleton value converters in WPF. But recently I got into an argument with a colleague where he was saying like it is bad to use singleton instance of valueconverters as they would be disposed only by the app domain unload. He was suggesting that singleton converters may come handy only in case of a page which is kept loaded until an application unload. Would really like to know views of WPF experts here.
EDIT (with example): I have a converter like
public class ABCConverter : IMultiValueConverter
{
private static ABCConverter _instance;
public static ABCConverter Instance
{
get { return _instance ?? (_instance = new ABCConverter()); }
}
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
return true;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
return false;
}
}
I presently use it in xaml as
Converter="{x:Static conv:ABCConverter.Instance}"
Thanks in advance.
Raj