Example #1
0
        IFluentRouteConfiguration IFluentRouteConfiguration.Namespaces(string[] namespaces, bool merge)
        {
            if (Namespaces == null || !merge)
            {
                Namespaces = namespaces;
            }
            else
            {
                Namespaces = Namespaces.Concat(namespaces).ToArray();
            }

            return(this);
        }
Example #2
0
        public string ToFormUrlEncoded()
        {
            bool first = true;
            var  sb    = new StringBuilder();

            foreach (var kv in Namespaces.Concat(Properties))
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    sb.Append('&');
                }
                sb.Append(Uri.EscapeDataString(kv.Value.Key));
                sb.Append('=');
                sb.Append(Uri.EscapeDataString(kv.Value.Value));
            }
            return(sb.ToString());
        }
Example #3
0
 public IEnumerable <KeyValuePair <string, string> > ToFormValues()
 {
     return(Namespaces.Concat(Properties).Select(pair => new KeyValuePair <string, string>(pair.Value.Key, pair.Value.Value)));
 }
Example #4
0
 public string AsString() =>
 string.Join(".", Namespaces.Concat(Enumerable.Repeat(Identifier, 1))) +
 (TypeParameters.IsNullOrEmpty() ? string.Empty :
  "<" + string.Join(", ", TypeParameters.Select(t => t.AsString())) + ">") +
 (IsArray ? "[]" : string.Empty);
Example #5
0
 /// <summary>
 /// 添加命名空间
 /// </summary>
 /// <param name="nameSpaces"></param>
 public void AddNS(IEnumerable <string> nameSpaces)
 {
     Namespaces = Namespaces.Concat(nameSpaces);
 }
Example #6
0
 /// <summary>
 /// 添加命名空间
 /// </summary>
 /// <param name="nameSpace"></param>
 public void AddNS(string nameSpace)
 {
     Namespaces = Namespaces.Concat(new string[] { nameSpace });
 }