Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

I dont' use lambdas for events, and always do += -= (sub/unsub) am I being paranoid?

$
0
0

I just created yet another handler for an event, and thought.. perhaps I'm just being supersticious here. I've looked at memory guidelines; but didn't see any clear cut answers.

What's the score with code like this:

    _player.Completion += _player_Completion;


    void _player_Completion (object sender, EventArgs e)
    {
        if (Element != null) {
            Element.HandlePlaybackFinished ();
        }
    }

is it safe to write it as ? or will that leak?

    _player.Completion += (object sender, EventArgs e)=>Element.HandlePlaybackFinished ();

Has anyone got a good blog article they can point to on the subject. I didn't find the Xamarin official documents particularly helpful.


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>