在我的应用程序中,我希望程序搜索列表,测试每个列表元素.如果list元素是所需的长度,那么我希望将其插入到新列表中.以下是我已经编写的代码
List<string> foo = new List<string>();
List<string> newFoo = new List<string>();
for (int h = 0; h < l; h++);
{
// Here I want to search through every element of foo and if the element
// length is greater than say 5 i want to add it to the newFoo
}
Run Code Online (Sandbox Code Playgroud)
我不知道如何搜索每个元素和我可以找到的任何示例使用LINQ我不想做,因为我确信有一个更简单的方法.任何帮助非常感谢.