Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Add Public implementation RemoveEventHandler in EventRegistrationTokenTable #18671

Merged
merged 3 commits into from
Jun 27, 2018

Conversation

luqunl
Copy link

@luqunl luqunl commented Jun 27, 2018

Add a public implementation API GetEventHandlerFromEventRegistrationToken for System.runtime.WindowsRuntime to consume instead of using FriendAccessAllowed/InternalVisiable

Corefx PR:dotnet/corefx#30699

/// Get EventHandler for specified EventRegistrationToken if it exists.
/// An internal contract between System.Private.Corelib and System.Runtime.WindowsRuntime
/// </summary>
public static T GetEventHandlerFromEventRegistrationToken<T>(EventRegistrationTokenTable<T> table, EventRegistrationToken token) where T : class
Copy link
Member

Choose a reason for hiding this comment

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

This also removes the token from the table. It is pretty non-obvious from the name.

Copy link
Member

Choose a reason for hiding this comment

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

I think we should just add this as public API to EventRegistrationTokenTable directly:

bool RemoveEventHandler(EventRegistrationToken token, out T handler)

There are other non-exposed public APIs on EventRegistrationTokenTable, so having one more is not a big deal.

Copy link
Author

Choose a reason for hiding this comment

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

Added RemoveEventHandler in EventRegistrationTokenTable

@luqunl luqunl changed the title Add Public implementation for WinRT EventHandler Add Public implementation RemoveEventHandler in EventRegistrationTokenTable Jun 27, 2018
@luqunl luqunl merged commit 7e6c6ce into dotnet:master Jun 27, 2018
@luqunl luqunl deleted the WinRTEvent branch June 27, 2018 23:13
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
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.

2 participants