看板 C_Sharp 關於我們 聯絡資訊
不知道有沒有誤解你的意思 string[] addressDatas = new string[0]; string pUserInput = ""; string[] keyWords = pUserInput.Split (' ', ','); var result = from tar in addressDatas where keyWords.Count (r => tar.Contains (r)) > 1//符合的數量 select tar; 或者進階一點 string[] addressDatas = new string[0]; string pUserInput = ""; string[] keyWords = pUserInput.Split (' ', ','); var result = from tar in addressDatas let num = keyWords.Count (r => tar.Contains (r)) where num > 0 let anonymous = new {nNum = num,address = tar} orderby anonymous.nNum descending select anonymous; -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.110.33.129 ※ 文章網址: https://www.ptt.cc/bbs/C_Sharp/M.1448130369.A.37B.html