Exemple #1
0
        public UriToken(UriTokenType type, string name, string @default, string format)
        {
            SubName = null;
            if (type == UriTokenType.Value)
            {
                var idx = name.AsSpan().IndexOf('.');
                if (name.EndsWith("[]", StringComparison.Ordinal))
                {
                    name = name.Substring(0, name.Length - 2);
                    type = UriTokenType.Collection;
                }
                else if (idx > 0)
                {
                    SubName = name.Substring(idx + 1);
                    name    = name.Substring(0, idx);
                }
            }

            Name    = name;
            Default = @default;
            Format  = format;
            Type    = type;

            DefaultConstant = Expression.Constant(Default, typeof(string));
            FormatConstant  = Expression.Constant(Format, typeof(string));
        }
Exemple #2
0
 public UriToken(UriTokenType type, string content, int trailingTextLength)
 {
 }