Skip to content

Commit c2cf4e9

Browse files
yecril71plpranavkm
andauthored
define RouteValuesAddress .ToString () (#39753)
Co-authored-by: Pranav K <prkrishn@hotmail.com>
1 parent 5823994 commit c2cf4e9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/Http/Routing/src/PublicAPI.Unshipped.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ Microsoft.AspNetCore.Routing.RouteOptions.SetParameterPolicy(string! token, Syst
33
Microsoft.AspNetCore.Routing.RouteOptions.SetParameterPolicy<T>(string! token) -> void
44
static Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPatch(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder! endpoints, string! pattern, System.Delegate! handler) -> Microsoft.AspNetCore.Builder.RouteHandlerBuilder!
55
static Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.MapPatch(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder! endpoints, string! pattern, Microsoft.AspNetCore.Http.RequestDelegate! requestDelegate) -> Microsoft.AspNetCore.Builder.IEndpointConventionBuilder!
6+
override Microsoft.AspNetCore.Routing.RouteValuesAddress.ToString() -> string?

src/Http/Routing/src/RouteValuesAddress.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33

44
#nullable enable
55

6+
using System.Linq;
67
namespace Microsoft.AspNetCore.Routing;
78

89
/// <summary>
910
/// An address of route name and values.
1011
/// </summary>
1112
public class RouteValuesAddress
1213
{
14+
private string? _toString;
1315
/// <summary>
1416
/// Gets or sets the route name.
1517
/// </summary>
@@ -24,4 +26,11 @@ public class RouteValuesAddress
2426
/// Gets or sets ambient route values from the current HTTP request.
2527
/// </summary>
2628
public RouteValueDictionary? AmbientValues { get; set; }
29+
30+
/// <inheritdoc />
31+
public override string? ToString()
32+
{
33+
_toString ??= $"{RouteName}({string.Join(',', ExplicitValues.Select(kv => $"{kv.Key}=[{kv.Value}]"))})";
34+
return _toString;
35+
}
2736
}

0 commit comments

Comments
 (0)