Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Jan 30, 2024

Fixes #41849

@ghost
Copy link

ghost commented Jan 30, 2024

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost ghost assigned jkotas Jan 30, 2024
@ghost
Copy link

ghost commented Jan 30, 2024

Tagging subscribers to this area: @dotnet/area-system-runtime
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #41849

Author: jkotas
Assignees: -
Labels:

area-System.Runtime, new-api-needs-documentation

Milestone: -

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

@stephentoub
Copy link
Member

Looks like there are a few places we could use HasSingleTarget, e.g.


private bool AddingNewHandled => _onAddingNew != null && _onAddingNew.GetInvocationList().Length > 0;

(though I don't understand that second one... won't _onAddingNew.GetInvocationList().Length > 0 always be true?)

@stephentoub
Copy link
Member

And a few places we could enumerate more cheaply?

foreach (Func<AssemblyLoadContext, AssemblyName, Assembly> handler in resolvingHandler.GetInvocationList())

foreach (ResolveEventHandler handler in eventHandler.GetInvocationList())

foreach (Func<Assembly, string, IntPtr> handler in dllResolveHandler.GetInvocationList())

@jkotas jkotas requested a review from stephentoub January 30, 2024 19:33
@jkotas
Copy link
Member Author

jkotas commented Jan 31, 2024

All failures are known according to the build analysis

@jkotas jkotas merged commit d2e51ee into dotnet:main Jan 31, 2024
@jkotas jkotas deleted the delegate-enumerator branch January 31, 2024 13:47
@github-actions github-actions bot locked and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get InvocationList of MulticastDelegate without any allocation
2 participants