Is it a bad idea to have wpf static converters?

Instead of declaring a converter in resources, I can do something like

IsEnabled={Binding Path=SomeProp, Converter={x:Static namespace:Converter.Instance}}"

where an instance is created only once (lazy sinner)

But I am concerned that references to static variables may interfere with garbage collection when disposing views (I use PRISM). What do you think?

+5
source share
1 answer

Indeed, a static converter instance will not be garbage collected, but this is just one instance, and typical converters do not have (or few) data fields, so there is probably nothing to worry about ...

, .

+3

All Articles