C# 把Parameter参数都列出来,把对象模型Json 化

https://www.cnblogs.com/wangjunwei/p/4523739.html

 

 sqlObj.Value.Select(x => string.Format("'{0}'='{1}'", x.ParameterName,x.Value)).ToList();

 

string.Join(",", param.Select(s => string.Format("{0}={1}", s.ParameterName, s.Value)).ToList())

 

”@Value=1“

 

 

string[] strArray = new string[] { "AA", "DD", "SSS", "EEE" };
 var sss2 = strArray.Select(x => string.Format("'{0}'", x)).ToList();
 string billcodeArray = string.Join(",", sss2);

 Console.WriteLine("列出所有参数:" + billcodeArray);

 

 

 

string s1 = "1,2,3,4,5,6";
string s1_1 = s1.Replace(",", "','"); //返回结果为:1','2','3','4','5','6
string s2 = string.Format("'{0}'", s1_1);//把 '{0}'中的 {0}替换为 1','2','3','4','5','6 这样结果就是 想得到的结果了


 List<string> strList = new List<string>();
            strList.Add("123123");
            strList.Add("BB");
            strList.Add("CC");
            strList.Add("DDD");
            strList.Add("WWW");
            strList.Add("1111");

            var sss2 = strList.Select(x => string.Format("'{0}'",x)).ToList();
            string billcodeArray = string.Join(",", sss2);

            Console.WriteLine("列出所有参数:" + billcodeArray);
posted @ 2021-06-16 12:57  LuoCore  阅读(233)  评论(0编辑  收藏  举报