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

Unit 3 Lesson 4. Why do we need to capture Sender into a local variable before passing it to PipeTo? #305

Open
ghost opened this issue Apr 11, 2020 · 0 comments

Comments

@ghost
Copy link

ghost commented Apr 11, 2020

Capturing Sender into local variable makes no sense here. PipeTo is executed sync. If we were to use Sender in ContinueWith lambda, then it would be necessary to capture, but why capture it here? This confuses me. And the importance of capturing Sender is repeated many times on different pages. Makes me think that either I am missing smth, or whoever wrote this made a mistake.

Receive<BeginProcessFeed>(feed =>
{
    //instance variable for closure
    var senderClosure = Sender; 
    SendMessage(string.Format("Downloading {0} for RSS/ATOM processing...", feed.FeedUri));

    //reply back to the sender
    _feedFactory.CreateFeedAsync(feed.FeedUri).PipeTo(senderClosure);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants