I recently wrote the following code to split a css file into chunks:
Dim seg = css.Take(css.Length / segmentCount).TakeWhile(Function(x) x <> "}"c).Take(1)
The idea being that I take a chunk of the css then continue taking until i hit a closing brace and then take the brace as well.
Obviously this didn't work and i realised why it doesnt almost immediately (The Take needle isnt maintained between the take calls).
My question is is there way to write this idea as a LINQ query efficiently considering that they string might be 300,000 characters or so long.
(I ended up using a combination of SubString and IndexOf for this but a one liner in LINQ would be interesting)