我該如何構造一個LINQ表達式來從一個列表中刪除符合返回布爾值的函數的條件的值?LINQ列表布爾函數的幫助
string[] message = "days of the week"
message.ToList().RemoveAll(c=>checkShortWord(c));
public static bool checkShortWord(string word) {
if ((word.Length > 3) &&
(!Regex.IsMatch(word, "^[0-9]+$")))
return true;
return false;
}
我的結局字符串數組現在應該是:
message = {"days","week"}
我應該怎麼改?我的消息數組從不改變。
啊..好吧..我會嘗試這個。謝謝 ! – 2010-07-10 16:33:14