List dansConList = new List(); dansConList[0] = 1; dansConList[1] = 2; dansConList[2] = 3; List dansRandomList = new List
Extension method:
public static bool IsConsecutive(this IEnumerable myList) { return myList.SequenceEqual(Enumerable.Range(myList.First(), myList.Last())); }
Useage:
bool isConsecutive = dansRandomList.IsConsecutive();