From 62294593d3a59b27609f3eeec7843988e008c96c Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Thu, 30 Nov 2023 15:32:11 -0800 Subject: [PATCH] Update asp0018.md (#31168) --- aspnetcore/diagnostics/asp0018.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/aspnetcore/diagnostics/asp0018.md b/aspnetcore/diagnostics/asp0018.md index 471bb9a50147..186b15ddca0e 100644 --- a/aspnetcore/diagnostics/asp0018.md +++ b/aspnetcore/diagnostics/asp0018.md @@ -21,7 +21,7 @@ A route parameter is specified but not used. ## Rule description -A route parameter is specified but not used. In the example below, the `name` parameter is defined in the route but not in the route handler. +A route parameter is specified but not used. In the example below, the `id` parameter is defined in the route but not in the route handler. ```csharp var app = WebApplication.Create(); @@ -32,6 +32,11 @@ app.MapGet("/{id}", () => ...); ## How to fix violations To fix a violation of this rule, remove the route parameter or add code that uses the parameter. +```csharp +var app = WebApplication.Create(); + +app.MapGet("/{id}", (id) => ...); +``` ## When to suppress warnings