I want to select all the words from a list whose length is less or equal to 5. My current code only returns this:
- true
- false
- false
- true
- true
- true
I want the result to be the actual words.
static void Main()
{
string[] words = { "hello", "Welcome", "Rolling", "in", "The", "Deep" };
var shortWords = from word in words select word.Length <= 5;
foreach (var word in shortWords) {
Console.WriteLine(word);
}
Console.Read();
}