Keeping a weakreference a strong reference for life time of class - Prism eventaggregator

  • Thread starter Thread starter stevensrf
  • Start date Start date
S

stevensrf

Guest
Is there a way to keep weakreference a strong reference for life time of class -

I am referring specifically to PRIMS's Eventaggregator



I know one could subscribe for a strong reference, but I like to subscribe to a weak reference so garbage collection does not have to be worried about.

The weak reference subscription is the life time of the class.

In a method setting a weak reference target to a local variable in the method will prevent the garbage collection for the life time of the method call.

Will setting a class variable to a weak reference target variable say in the constructor keep the weak reference target as a strong reference for the life of the class?

Is doing something like this a good or bad idea and why?


steven frierdich

Continue reading...
 
Back
Top