添加项目文件。

This commit is contained in:
chfei committed 2026-08-14 18:00:58 +08:00
1 parent 6a017c9547
commit 58abbb5b4f
86 files changed
+8729

No files matched your search

@@ -0,0 +1,33 @@
using MAX.Core.Cryptography;
using System.Collections.Generic;
using System.Text;
namespace MAX.Core.Extensions;
public static class DictionaryExtension
{
/// <summary>
/// 字典转url Get 参数
/// </summary>
/// <param name="parameters"></param>
/// <returns></returns>
public static string ToUrlParams(this IDictionary<string, string> parameters, bool IsUrlEncode = true)
{
IDictionary<string, string> sortedParams = new SortedDictionary<string, string>(parameters);
IEnumerator<KeyValuePair<string, string>> dem = sortedParams.GetEnumerator();
StringBuilder sb = new("");
while (dem.MoveNext())
{
string key = dem.Current.Key;
string value = dem.Current.Value;
if (!string.IsNullOrEmpty(key))
{
sb.Append(key).Append("=").Append(IsUrlEncode ? UrlHelper.Encode(value) : value).Append("&");
}
}
string content = sb.ToString().Substring(0, sb.Length - 1);
return content;
}
}