It was not entirely clear how to name this question, so I would appreciate it if they correct the topic.
There is a function for getting only non-empty strings from an array.
public static int[] ParseNumbers(IEnumerable<string> lines) { return lines .Where(x => x != "") .Select(int.Parse) .ToArray(); } Why in Select(int.Parse) and not Selext(x=>x) ? Although this code works without problems, it is not entirely clear how it works.
Select(x=>x)returnsIEnumerable<string>and after callingToArrayresult is an array of strings, and the function needs to return an array of integers, so the functionint.Parse- Grundy is applied to each elementx => int.Parse(x)and that's it. - Monk