For example, if I have a UserControl or a Page that creates its own event in its code-behind file, when that Page or control unloads, do I have to make sure its events are unsubscribed from? I mean there are no external subscriptions. Every subscriber is self-contained, so I would THINK that it wouldn't matter once the control is unloaded:
public sealed partial class MyPage : Page
{
public MyPage()
{
this.Unloaded += Page_Unloaded;
this.Tapped += Page_Tapped;
}
private void Page_Tapped(object sender, TappedRoutedEventArgs e)
{
// Do some work here.
}
private void Page_Unloaded(object sender, RoutedEventArgs e)
{
// Is the following appropriate and REQUIRED?
this.Unloaded -= Page_Unloaded;
this.Tapped -= Page_Tapped;
}
}