Detecting sequence of at least 3 sequential numbers from a given list
问题 I have a list of numbers e.g. 21,4,7,9,12,22,17,8,2,20,23 I want to be able to pick out sequences of sequential numbers (minimum 3 items in length), so from the example above it would be 7,8,9 and 20,21,22,23. I have played around with a few ugly sprawling functions but I am wondering if there is a neat LINQ-ish way to do it. Any suggestions? UPDATE: Many thanks for all the responses, much appriciated. Im am currently having a play with them all to see which would best integrate into our