首页 > Windows开发 > 详细

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

时间:2021-05-08 16:11:27      阅读:15      评论:0      收藏:0      [点我收藏+]
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>

原文:https://www.cnblogs.com/LuoEast/p/14743944.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!