C# SortedList RemoveAt
Description
SortedList RemoveAt
removes the element at the specified
index of a SortedList object.
Syntax
SortedList.RemoveAt
has the following syntax.
public virtual void RemoveAt(
int index
)
Parameters
SortedList.RemoveAt
has the following parameters.
index
- The zero-based index of the element to remove.
Returns
SortedList.RemoveAt
method returns
Example
The following code example shows how to remove elements from a SortedList object.
/*from w w w . ja va2s . c o m*/
using System;
using System.Collections;
public class SamplesSortedList {
public static void Main() {
SortedList mySL = new SortedList();
mySL.Add( "3c", "dog" );
mySL.Add( "2c", "over" );
mySL.Add( "1c", "brown" );
mySL.Add( "1a", "The" );
mySL.Add( "1b", "quick" );
mySL.Add( "3a", "the" );
mySL.Add( "3b", "lazy" );
mySL.Add( "2a", "fox" );
mySL.Add( "2b", "jumped" );
mySL.RemoveAt( 5 );
}
}
The code above generates the following result.