I want to split this line:
string line = "First Name ; string ; firstName";
into an array of their trimmed versions:
"First Name"
"string"
"firstName"
How can I do this all on one line? The following gives me an error "cannot convert type void":
List<string> parts = line.Split(';').ToList().ForEach(p => p.Trim());
ForEach
works on current instance ofIEnumerable
and returnsvoid
. – Majkel