/// <summary>
/// Returns a portion of the list whose keys are greater that the lowerLimit parameter less than the upperLimit parameter.
/// </summary>
/// <param name="l">The list where the portion will be extracted.</param>
/// <param name="limit">The start element of the portion to extract.</param>
/// <param name="limit">The end element of the portion to extract.</param>
/// <returns>The portion of the collection.</returns>
public static System.Collections.SortedList SubMap(System.Collections.SortedList list, System.Object lowerLimit, System.Object upperLimit)
{
System.Collections.Comparer comparer = System.Collections.Comparer.Default;
System.Collections.SortedList newList = new System.Collections.SortedList();
if (list != null)
{
if ((list.Count > 0) && (!(lowerLimit.Equals(upperLimit))))
{
int index = 0;
while (comparer.Compare(list.GetKey(index), lowerLimit) < 0)
{
index++;
}
for (; index < list.Count; index++)
{
if (comparer.Compare(list.GetKey(index), upperLimit) >= 0)
{
break;
}
newList.Add(list.GetKey(index), list[list.GetKey(index)]);
}
}
}
return(newList);
}