IFluentRouteConfiguration IFluentRouteConfiguration.Namespaces(string[] namespaces, bool merge) { if (Namespaces == null || !merge) { Namespaces = namespaces; } else { Namespaces = Namespaces.Concat(namespaces).ToArray(); } return(this); }
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()); }
public IEnumerable <KeyValuePair <string, string> > ToFormValues() { return(Namespaces.Concat(Properties).Select(pair => new KeyValuePair <string, string>(pair.Value.Key, pair.Value.Value))); }
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);
/// <summary> /// 添加命名空间 /// </summary> /// <param name="nameSpaces"></param> public void AddNS(IEnumerable <string> nameSpaces) { Namespaces = Namespaces.Concat(nameSpaces); }
/// <summary> /// 添加命名空间 /// </summary> /// <param name="nameSpace"></param> public void AddNS(string nameSpace) { Namespaces = Namespaces.Concat(new string[] { nameSpace }); }