SortedList.Remove removes the element with the specified key from a SortedList object.
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" ); PrintKeysAndValues( mySL ); mySL.Remove( "3b" ); PrintKeysAndValues( mySL ); mySL.RemoveAt( 5 ); PrintKeysAndValues( mySL ); } public static void PrintKeysAndValues( SortedList myList ) { for ( int i = 0; i < myList.Count; i++ ) { Console.WriteLine( "\t{0}:\t{1}", myList.GetKey(i), myList.GetByIndex(i) ); } } }