From 9462198c4f127758fa37699263b38dcd7b017f88 Mon Sep 17 00:00:00 2001 From: Jonathan Steele Date: Wed, 13 Nov 2024 17:29:43 -0500 Subject: [PATCH] update .NET 9 --- App.xaml.cs | 5 ++++- HackerNews.csproj | 6 +++--- NewsViewModel.cs | 6 ++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/App.xaml.cs b/App.xaml.cs index 07d7f1a..2fbe241 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -5,7 +5,10 @@ public partial class App : Application public App() { InitializeComponent(); + } - MainPage = new AppShell(); + protected override Window CreateWindow(IActivationState? activationState) + { + return new Window(new AppShell()); } } \ No newline at end of file diff --git a/HackerNews.csproj b/HackerNews.csproj index 9aff29c..89163cd 100644 --- a/HackerNews.csproj +++ b/HackerNews.csproj @@ -1,13 +1,13 @@  - net8.0-ios;net8.0-maccatalyst;net8.0-android - $(TargetFrameworks);net8.0-windows10.0.19041.0 + net9.0-ios;net9.0-maccatalyst;net9.0-android + $(TargetFrameworks);net9.0-windows10.0.19041.0 Library HackerNews true - 8.0.93 + 9.0.0 true enable diff --git a/NewsViewModel.cs b/NewsViewModel.cs index aecb016..1859619 100644 --- a/NewsViewModel.cs +++ b/NewsViewModel.cs @@ -59,8 +59,7 @@ static void InsertIntoSortedCollection(ObservableCollection collection, Co private async IAsyncEnumerable GetTopStoriesAsync() { - List topStoryIds = []; - + List topStoryIds; try { var topStoriesJson = await _newsService.GetTopStoryAsJsonAsync(); @@ -74,8 +73,7 @@ private async IAsyncEnumerable GetTopStoriesAsync() foreach (var id in topStoryIds) { - StoryModel story = null; - + StoryModel story; try { story = await _newsService.GetTopStoryAsync(id);