是的,C#的RemoveAll方法支持Lambda表達式作為參數。Lambda表達式可以用來指定要刪除的元素的條件。例如:
RemoveAll
List<int> numbers = new List<int>{1, 2, 3, 4, 5}; numbers.RemoveAll(num => num % 2 == 0); // 刪除所有偶數
在上面的例子中,RemoveAll方法使用了Lambda表達式num => num % 2 == 0作為參數,表示刪除所有偶數。
num => num % 2 == 0