Here you create an anonymous type:
new { Node = line.Trim() }
This is optional, just return
line.Trim()
and you have IEnumerable of string . Then your ToArray will work:
var possibleElements = from line in allLinesInAFile where !this.IsNode(line) select line.Trim(); string[] xmlLines = possibleElements.ToArray();
Another variant:
possibleElements.Select(x => x.Node).ToArray();
source share