I have the following code:
var accidents = text.Skip(NumberOfAccidentsLine + 1).Take(numberOfAccidentsInFile).ToArray();
where the crash is an array of strings.
I want to convert Linq from a string array to an array of Accident objects as follows:
return accidents.Select(t => new Accident() {Id = i, Name = t.Replace("\"", string.Empty)}).ToArray();
How to get index i from an array of crashes using linq or do i need to go to an old school?
source share