using System.Collections.Generic;
public static void Main()
List<int> lstInput = new List<int>(){1,2,3,4,5,6,7,9,10,11,22};
List<List<int>> lstSubLists = new List<List<int>>();
int firstKey = lstInput[0];
List<int> lstTemp = new List<int>();
for(int i=1;i<=lstInput.Count;i++)
firstKey = lstInput[i-1];
if (i<lstInput.Count && lstInput[i-1] == (lstInput[i]-1))
lstTemp.Add(lstInput[i-1]);
lstSubLists.Add(lstTemp);
lstTemp = new List<int>();
Console.WriteLine("i = "+ i + " First Key = " + firstKey + " LastKey = " + lastKey);
Console.WriteLine("\n\nSub Lists \n\n");
foreach(List<int> lstOfInt in lstSubLists)
Console.WriteLine( string.Join(",",lstOfInt.ToArray())+"\n" );