Dynamic method to open screens

0

I'm creating a method to open any screen I pass in the parameter.

I did this method:

public async Task NavigateTo(Page page)
{
    await App.MasterDetail.Detail.Navigation.PushAsync(new page());    
}

But every time I'll compile from an error

CS0118  "page" é um variável, mas é usado como um tipo

What do I need to do to work?

    
asked by anonymous 21.09.2017 / 01:22

1 answer

1

Try changing it:

public async Task NavigateTo(Page page)
{
    await App.MasterDetail.Detail.Navigation.PushAsync(new page());    
}

To:

public async Task NavigateTo(Page page)
{
    await App.MasterDetail.Detail.Navigation.PushAsync(page);    
}
    
21.09.2017 / 01:55