From b354d6428ea312580b91e3f1431cedc7ce9628c7 Mon Sep 17 00:00:00 2001 From: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com> Date: Tue, 12 Jul 2022 13:19:28 -1000 Subject: [PATCH] Bind arrays in What's new --- aspnetcore/fundamentals/minimal-apis.md | 2 ++ aspnetcore/release-notes/aspnetcore-7.0.md | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/aspnetcore/fundamentals/minimal-apis.md b/aspnetcore/fundamentals/minimal-apis.md index 41c16ccf8de7..1673f58874e1 100644 --- a/aspnetcore/fundamentals/minimal-apis.md +++ b/aspnetcore/fundamentals/minimal-apis.md @@ -1327,6 +1327,8 @@ The following types are bound without explicit attributes: app.MapGet("/", (ClaimsPrincipal user) => user.Identity.Name); ``` + + ### Bind arrays and string values from headers and query strings The following code demonstrates binding query strings to an array of primitive types, string arrays, and [StringValues](/dotnet/api/microsoft.extensions.primitives.stringvalues): diff --git a/aspnetcore/release-notes/aspnetcore-7.0.md b/aspnetcore/release-notes/aspnetcore-7.0.md index e278402522eb..8b1601c4d569 100644 --- a/aspnetcore/release-notes/aspnetcore-7.0.md +++ b/aspnetcore/release-notes/aspnetcore-7.0.md @@ -51,6 +51,14 @@ Filters can be helpful in the following scenarios: For more information, see +### Bind arrays and string values from headers and query strings + +In ASP.NET 7, binding query strings to an array of primitive types, string arrays, and [StringValues](/dotnet/api/microsoft.extensions.primitives.stringvalues) is supported: + +[!code-csharp[](~/fundamentals/minimal-apis/bindingArrays/7.0-samples/todo/Program.cs?name=snippet_bqs2pa)] + +Binding query strings or header values to an array of complex types is supported when the type has `TryParse` implemented. For more information, see [Bind arrays and string values from headers and query strings](xref:fundamentals/minimal-apis?view=aspnetcore-7.0&preserve-view=true#bindar). + ## Signal R ### Dependency injection for SignalR hub methods