In C#,
Given the following array of integers e.g. 100001 100002 100005 100006 100007 100009 100011
I want to produce a data structure holding the following values
[0] => {Type= "Continuous", Count=2, Items = [100001, 100002]}
[1] => {Type= "Continuous", Count=3, Items = [100005, 100006, 100007]}
[2] => {Type= "Individual", Count=2, Items = [100008, 100011]}
The data structure is not important. I am looking for an algorithm to group the integers in this way.