Is the call to base.OnAppearing() necessary when inheriting from ContentPage?

Looking at the source from Xamarin.Forms.Page:

protected virtual void OnAppearing()
{
}

I'm curious if the call to base.OnAppearing() is necessary when inheriting from ContentPage? Example:

public class MyPage : ContentPage
{
    protected override void OnAppearing()
    {
        // make a call to the base, that does nothing for now
        base.OnAppearing();
        // ...
    }
}

Is this protected virtual method likely to change in the future and should I just follow the docs and include the call to the base when overriding?

To be clear, I understand that it is necessary to call base.OnAppearing() if I wish to override this method when inheriting from Xamarin.Forms.MasterDetailPage.

Answers

  • Amar_BaitAmar_Bait DZMember ✭✭✭✭✭
    edited July 8

    I don't think that the base method does anything (EDIT: just saw you posted the source code, so yeah it's an empty method). So I would presume it is safe to ignore it. But I would still keep it just in case something changes in the future Xamarin.Forms versions.

Sign In or Register to comment.