CSharp examples for System.Collections.Generic:List
Returns a portion of the list whose keys are greater than the limit object parameter.
using System.IO;/*from ww w. ja va 2 s .co m*/ using System; public class Main{ /// <summary> /// Returns a portion of the list whose keys are greater than the limit object parameter. /// </summary> /// <param name="list">The list where the portion will be extracted.</param> /// <param name="limit">The start element of the portion to extract.</param> /// <returns>The portion of the collection whose elements are greater than the limit object parameter.</returns> public static System.Collections.SortedList TailMap(System.Collections.SortedList list, Object limit) { System.Collections.Comparer comparer = System.Collections.Comparer.Default; System.Collections.SortedList newList = new System.Collections.SortedList(); if (list != null) { if (list.Count > 0) { int index = 0; while (comparer.Compare(list.GetKey(index), limit) < 0) index++; for (; index < list.Count; index++) newList.Add(list.GetKey(index), list[list.GetKey(index)]); } } return newList; } }