Welcome to mirror list, hosted at ThFree Co, Russian Federation.

RoutePatternSeparatorPart.cs « Patterns « src « Routing « Http « src - github.com/dotnet/aspnetcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9dd59537c773884b4eb5ae2da3ff1f3a0aa07670 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics;

namespace Microsoft.AspNetCore.Routing.Patterns
{
    /// <summary>
    /// Represents an optional separator part of a route pattern. Instances of <see cref="RoutePatternSeparatorPart"/>
    /// are immutable.
    /// </summary>
    /// <remarks>
    /// <para>
    /// An optional separator is a literal text delimiter that appears between
    /// two parameter parts in the last segment of a route pattern. The only separator
    /// that is recognized is <c>.</c>.
    /// </para>
    /// <para>
    /// <example>
    /// In the route pattern <c>/{controller}/{action}/{id?}.{extension?}</c>
    /// the <c>.</c> character is an optional separator.
    /// </example>
    /// </para>
    /// <para>
    /// An optional separator character does not need to present in the URL path
    /// of a request for the route pattern to match.
    /// </para>
    /// </remarks>
    [DebuggerDisplay("{DebuggerToString()}")]
    public sealed class RoutePatternSeparatorPart : RoutePatternPart
    {
        internal RoutePatternSeparatorPart(string content)
            : base(RoutePatternPartKind.Separator)
        {
            Debug.Assert(!string.IsNullOrEmpty(content));

            Content = content;
        }

        /// <summary>
        /// Gets the text content of the part.
        /// </summary>
        public string Content { get; }

        internal override string DebuggerToString()
        {
            return Content;
        }
    }
}