C# 俩个字符串数据进行对比取出不同的数据


string sel_JD = "电冰箱,电热水壶,客厅空调,饮水机,";
string Operation_JD = "电冰箱,电热水壶,电动汽车,";
List<string> select_operation = new List<string>();
string[] sel_arr = sel_JD.Split(',');
IEnumerable<string> nameQuery = from name in sel_arr
select name;
string result = "";
foreach (string tt in nameQuery)
{
if (!Operation_JD.Contains(tt))
{
result += tt+";";
}
}
result = result.Substring(0, result.Length - 1);
Console.WriteLine(result);

posted @ 2022-03-11 17:48  小小怪战士  阅读(663)  评论(0编辑  收藏  举报