File tree Expand file tree Collapse file tree 1 file changed +1
-11
lines changed
Microsoft.Toolkit.Mvvm/Messaging Expand file tree Collapse file tree 1 file changed +1
-11
lines changed Original file line number Diff line number Diff line change @@ -156,18 +156,8 @@ public void UnregisterAll(object recipient)
156156 // Removes all the lists of registered handlers for the recipient
157157 foreach ( IMapping mapping in set ! )
158158 {
159- if ( mapping . TryRemove ( key , out object ? handlersMap ) )
159+ if ( mapping . TryRemove ( key , out _ ) )
160160 {
161- // If this branch is taken, it means the target recipient to unregister
162- // had at least one registered handler for the current <TToken, TMessage>
163- // pair of type parameters, which here is masked out by the IMapping interface.
164- // Before removing the handlers, we need to retrieve the count of how many handlers
165- // are being removed, in order to update the total counter for the mapping.
166- // Just casting the dictionary to the base interface and accessing the Count
167- // property directly gives us O(1) access time to retrieve this count.
168- // The handlers map is the IDictionary<TToken, TMessage> instance for the mapping.
169- int handlersCount = Unsafe . As < IDictionarySlim > ( handlersMap ) . Count ;
170-
171161 if ( mapping . Count == 0 )
172162 {
173163 // Maps here are really of type Mapping<,> and with unknown type arguments.
You can’t perform that action at this time.
0 commit comments