C# 关于 &符号,字符串转字典Dictionary

private static Dictionary<string, string> ParseToDictionary(string str)
        {
            Dictionary<string, string> result = new Dictionary<string, string>();

            var pairs = str.Split(&);
            foreach (var p in pairs)
            {
                var items = p.Split(=);
                if (items.Length == 2)
                {
                    result.Add(items[0], items[1]);
                }
                else
                    continue;
            }

            return result;
        }

 

C# 关于 &符号,字符串转字典Dictionary<string, string>

上一篇:cf - 1443C - The Delivery Dilemma


下一篇:windows docker环境下openLDAP初探