Proposal: Improve the constraint support for delegate constraints to enable generic event subscription #1739
Replies: 2 comments
-
Technically not. The CLR will allow The proposal that was implemented only intended to remove the language restriction preventing you from being able to use I don't know what your actual use case is or if the example above is representative. If the |
Beta Was this translation helpful? Give feedback.
-
You're correct. If it were not public it would not be as useful, however that is just the problem where i noticed it, that the code i am trying to develop does not even compile that way. However i've used code like The way it is now, i cannot even declare the event, so i am not able to raise the delegate, since the class does not compile. That's a big problem imo. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As specified here dotnet/roslyn#28835 i am unhappy with the current usefulness of the delegate constraint. While it does solve some scenarios, which were not possible yet, i think there is one important scenario where there is a big usability gap still.
Currently there is no way for this to compile:
Being unable to subscribe to that event, nor even being able to declare the event in a class is quite a pitfall in the usefulness of the delegate constraint.
Beta Was this translation helpful? Give feedback.
All reactions