EventAggregator resubscribe for weakreference? #2256
Unanswered
stevensrf11
asked this question in
General
Replies: 1 comment
-
Not that I'm aware of. Kind of the point of the weak reference is that it can sneak out of the party when everyone stops interacting with it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there any easy way to get detection exactly when a weak reference subscription to an eventaggregator has been garbage collected?
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 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?
Beta Was this translation helpful? Give feedback.
All reactions