-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update delegates-overview.md #42742
base: main
Are you sure you want to change the base?
Update delegates-overview.md #42742
Conversation
1. This conceptual article is only about delegates but should provide an introduction to delegates and events. 2. The conceptual article should not refer to a concrete implementation (C#). 3. Consider adding a common article providing a general introductory delegate and event preface.
@BillWagner are there any plans related to this pr? FYI: I want to contribute to this and similar issues through a video publication Programming in Practice - Delegates and Events Events and delegates control flow, exchange data, and notify a condition change backed by code samples. Referring to our previous conversation |
For the time being, I'd like to keep any edits small. For historical reasons, there are two very similar sections in the C# guide that explain delegates this one, and a similar section in the programming guide. I plan on combining these two sections after the November release of .NET 9. Before then, I only want to consider changes that are small in scope. Yes, these additional paragraphs are small in scope. I don't think this adds any clarity. It defines other uses of the same words. I don't think that's helpful. But, I do agree that this article currently assumes too much knowledge. Instead, how about a single small paragraph that defines the concepts of "delegate" and "event" in the concept of C#. Something like:
|
My knowledge about delegates and events comes only from my experience and general knowledge. Thanks to this opportunity I have just reviewed the documentation and defined the following entry points related to the topic: .NET fundamentals documentation:
C# documentation:
C# language reference:
It is only my first attempt. I must say that the documentation is overloaded in this respect. Many places describe similar things using different terms hard to understand. For example, BTW, where mapping file, defining the content of the documentation suits, can be found? Now I see my proposal in the context of a particular file but not in the context of the architecture of a documentation suit. It seems to me that the title of this section partiality is cloned in an additional document in the same section. If I remember correctly, it could confuse reader which one documentation entry should be checked out to learn introduction to events.
My proposal describes the concept and should be placed in the conceptual documentation detached from the particular programming language. My point is that, by design, the conceptual documentation suit should not refer to the concrete programming language because the same concepts (e.g. delegates and events) have been with us for ages even before C# adge. This way we can offer the documentation even to people not serious about C#. Again, if you need any help I am open to proposals.
I agree there should be a conceptual introduction to delegates and events in the context of type-safe pointers to methods (references). Methods but not functions, because, according to my knowledge, a function is a method returning a value. If there is no return value we have procedures. Methods cover both. In your proposal API (application program interface) refers probably to the .NET library but the usage of delegates is much broader, for example in concurrent programming, asynchronous programming, WPF, etc. Simplification in this respect could be confusing. Finally, my proposal is as follows:
|
@BillWagner My point is, that this article is hard to understand and inconsistent with the documentation as one whole.. Let's continue working on delegates and events concepts. I have just provided a preface to a document, which should describe both concepts but only describes delegate as C# implementation. Consider creating an independent introductory and independent document common for delegate and event concepts.
Summary
Internal previews