using System; //using System.Collections.Generic; using System.Linq; using System.Text; using Unit4.CollectionsLib; namespace ConsoleApplication1 { class Program { public static List CreateRangeList(List sourceList) { List L = new List(); Node pos1 = sourceList.GetFirst(); Node pos2 = null; int b = pos1.GetInfo(), f; while (pos1.GetNext() != null) { if (pos1.GetInfo() + 1 != pos1.GetNext().GetInfo()) { f = pos1.GetInfo(); pos2 = L.Insert(pos2, new RangeNode(b, f)); b = pos1.GetNext().GetInfo(); } pos1 = pos1.GetNext(); } L.Insert(pos2, new RangeNode(b, pos1.GetInfo())); return L; } static void Main(string[] args) { } } }