I\'d like to use the LINQ TakeWhile function on LINQ to Objects. However, I also need to know the first element that \"broke\" the function, i.e. the first elem
TakeWhile
Just for fun:
var a = new[] { "two", "three", "four", "five", }; Func predicate = item => item.StartsWith("t"); a.TakeWhile(predicate).Concat(new[] { a.SkipWhile(predicate).FirstOrDefault() })