diff --git a/.github/workflows/markdownlint.yml b/.github/workflows/markdownlint.yml index 74279c2dceb..b4230869ac8 100644 --- a/.github/workflows/markdownlint.yml +++ b/.github/workflows/markdownlint.yml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 #@v2 - name: Use Node.js - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 #@v1 + uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 #@v1 with: node-version: 12.x - name: Run Markdownlint diff --git a/.github/workflows/snippets5000.yml b/.github/workflows/snippets5000.yml index a9108afae7e..be9f896175a 100644 --- a/.github/workflows/snippets5000.yml +++ b/.github/workflows/snippets5000.yml @@ -62,7 +62,7 @@ jobs: # Update build output json file - name: Upload build results - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #@v4.6.2 + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 #@v5.0.0 with: name: build path: ./output.json diff --git a/csharp/getting-started/console-webapiclient/Program.cs b/csharp/getting-started/console-webapiclient/Program.cs index 141266bb4e3..eee777bdc50 100644 --- a/csharp/getting-started/console-webapiclient/Program.cs +++ b/csharp/getting-started/console-webapiclient/Program.cs @@ -1,5 +1,5 @@ using System.Net.Http.Headers; -using System.Text.Json; +using System.Net.Http.Json; using HttpClient client = new(); client.DefaultRequestHeaders.Accept.Clear(); @@ -22,9 +22,6 @@ static async Task> ProcessRepositoriesAsync(HttpClient client) { - await using Stream stream = - await client.GetStreamAsync("https://api.github.com/orgs/dotnet/repos"); - var repositories = - await JsonSerializer.DeserializeAsync>(stream); - return repositories ?? new(); + var repositories = await client.GetFromJsonAsync>("https://api.github.com/orgs/dotnet/repos"); + return repositories ?? new List(); } diff --git a/csharp/getting-started/console-webapiclient/Repository.cs b/csharp/getting-started/console-webapiclient/Repository.cs index b43527db56f..2dee1646717 100644 --- a/csharp/getting-started/console-webapiclient/Repository.cs +++ b/csharp/getting-started/console-webapiclient/Repository.cs @@ -1,13 +1,13 @@ -using System; -using System.Text.Json.Serialization; +using System.Text.Json.Serialization; -public sealed record class Repository( - [property: JsonPropertyName("name")] string Name, - [property: JsonPropertyName("description")] string Description, +public record class Repository( + string Name, + string Description, [property: JsonPropertyName("html_url")] Uri GitHubHomeUrl, - [property: JsonPropertyName("homepage")] Uri Homepage, - [property: JsonPropertyName("watchers")] int Watchers, - [property: JsonPropertyName("pushed_at")] DateTime LastPushUtc) + Uri Homepage, + int Watchers, + [property: JsonPropertyName("pushed_at")] DateTime LastPushUtc +) { public DateTime LastPush => LastPushUtc.ToLocalTime(); } diff --git a/csharp/getting-started/console-webapiclient/webapiclient.csproj b/csharp/getting-started/console-webapiclient/webapiclient.csproj index cba1ce1334c..93d988e5f1a 100644 --- a/csharp/getting-started/console-webapiclient/webapiclient.csproj +++ b/csharp/getting-started/console-webapiclient/webapiclient.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net9.0 enable enable