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