Complete the code to flatten the list of lists using LINQ.
var numbers = new List<List<int>> { new List<int> {1, 2}, new List<int> {3, 4} };
var flat = numbers.[1](x => x).ToList();The SelectMany method flattens a collection of collections into a single collection.
Complete the code to flatten and filter numbers greater than 2.
var numbers = new List<List<int>> { new List<int> {1, 2}, new List<int> {3, 4} };
var result = numbers.[1](x => x).Where(n => n > 2).ToList();SelectMany flattens the list, then Where filters numbers greater than 2.
Fix the error in the code to flatten the list of arrays.
string[][] words = { new string[] {"apple", "banana"}, new string[] {"cherry"} };
var flatWords = words.[1](w => w).ToList();SelectMany flattens the array of arrays into a single list of strings.
Fill both blanks to flatten and select the length of each word.
var words = new List<List<string>> { new List<string> {"cat", "dog"}, new List<string> {"bird"} };
var lengths = words.[1](w => w).Select(word => word.[2]).ToList();SelectMany flattens the list, then Length gets each word's length.
Fill all three blanks to flatten, filter words longer than 3, and convert to uppercase.
var words = new List<List<string>> { new List<string> {"cat", "dog"}, new List<string> {"bird", "fish"} };
var result = words.[1](w => w).Where(word => word.[2] > 3).Select(word => word.[3]()).ToList();SelectMany flattens the list, Length filters words longer than 3, and ToUpper() converts words to uppercase.
