Suppose I have 3 screens in Xaml and I use MasterDetailPage and NavigationPage to navigate between these screens back and forth. Page A - > Page B - > Page C - > ...
I use PushAsync to do the browsing. So good ...
I've implemented this in two ways:
1 - I create a new instance of each screen every time I navigate:
await Navigation.PushAsync(new Views.PageA());
2 - I create a static property (in App View) for each screen and use this property to navigate:
public static Views.PageA PageA
{
get
{
if (_pageA == null)
{
_pageA = new Views.PageA();
}
return _pageA =;
}
}
await Navigation.PushAsync(App.PageA);
Is there another way to do this? Do I use static or create a new instance every time?
My concern is about performance and memory usage.
Please leave your answer with your opinion and if you can leave some code I thank you.