// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; using System.Diagnostics; using System.Linq; namespace Microsoft.AspNetCore.Routing.Patterns { /// /// Represents a path segment in a route pattern. Instances of are /// immutable. /// /// /// Route patterns are made up of URL path segments, delimited by /. A /// contains a group of /// that represent the structure of a segment /// in a route pattern. /// [DebuggerDisplay("{DebuggerToString()}")] public sealed class RoutePatternPathSegment { internal RoutePatternPathSegment(RoutePatternPart[] parts) { Parts = parts; } /// /// Returns true if the segment contains a single part; /// otherwise returns false. /// public bool IsSimple => Parts.Count == 1; /// /// Gets the list of parts in this segment. /// public IReadOnlyList Parts { get; } internal string DebuggerToString() { return DebuggerToString(Parts); } internal static string DebuggerToString(IReadOnlyList parts) { return string.Join(string.Empty, parts.Select(p => p.DebuggerToString())); } } }