Skip to content
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

Add reference to "subscribing to an event" in regards to += operator #8371

Closed
simshaun opened this issue Oct 15, 2018 · 2 comments
Closed

Add reference to "subscribing to an event" in regards to += operator #8371

simshaun opened this issue Oct 15, 2018 · 2 comments
Labels
doc-enhancement Improve the current content [org][type][category] good first issue Issue should be good for first-time contributors, with clear instructions help wanted Good for community contributors to help [up-for-grabs]

Comments

@simshaun
Copy link
Contributor

simshaun commented Oct 15, 2018

Hi,

C# newbie here...

Coming from other languages I've always been used to += meaning "add to" and did a double-take when seeing the += operator used with a lambda on the right-hand side in the following example found at the bottom of the page:

public MainWindow()
{
    InitializeComponent();

    Loaded += (o, e) =>
    {
        this.Title = "Loaded";
    };
}

I had to go searching to find out how that works. It's explained in the C# reference on the += operator of course, but it would be helpful (for beginners like me) to copy/paste the blurb from that page over to the "Delegates and lambdas" page. I'm referring to this one:

The use of the += operator in this context is referred to as subscribing to an event. For more information, see How to: Subscribe to and Unsubscribe from Events.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@cbrit
Copy link

cbrit commented Nov 19, 2018

+1
The doc is pretty clear until the last example.

@mairaw
Copy link
Contributor

mairaw commented Dec 17, 2018

Thanks @simshaun, that's a great suggestion! Would you like to submit a pull request for this?

We explain how to do that in the following article:
https://docs.microsoft.com/en-us/contribute/#quick-edits-to-existing-documents

@mairaw mairaw added doc-enhancement Improve the current content [org][type][category] help wanted Good for community contributors to help [up-for-grabs] good first issue Issue should be good for first-time contributors, with clear instructions and removed ⌚ Not Triaged Not triaged labels Dec 17, 2018
@mairaw mairaw added this to the Backlog milestone Dec 17, 2018
@mairaw mairaw added the P2 label Dec 17, 2018
@mairaw mairaw removed this from the Backlog milestone Dec 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-enhancement Improve the current content [org][type][category] good first issue Issue should be good for first-time contributors, with clear instructions help wanted Good for community contributors to help [up-for-grabs]
Projects
None yet
Development

No branches or pull requests

5 participants