In C#
var parameters =
from line in parameterTextBox.Lines
select new {name = line.Split(' ').First(), value = line.Split(' ').Skip(1)};
Is there a way to do this without having to split twice?
you can store the split in a let
clause
var parameters =
from line in parameterTextBox.Lines
let split = line.Split(' ')
select new {name = split.First(), value = split.Skip(1)};
Sure.
var parameters = from line in parameterTextBox.Lines
let words = line.Split(' ')
select new { name = words.First(), words.skip(1) };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With