C# SortedList Item

Description

SortedList Item gets and sets the value associated with a specific key in a SortedList object.

Syntax

SortedList.Item has the following syntax.


public virtual Object this[
  Object key
] { get; set; }

Parameters

SortedList.Item has the following parameters.

  • key - The key associated with the value to get or set.

Example


//  w w w .  ja  v a 2s  . c o  m
using System;
using System.Collections;
public class SamplesSortedList  {
   public static void Main()  {
      SortedList mySL = new SortedList();
      mySL[2] =  "two";

   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Collections »




ArrayList
BitArray
Comparer
Hashtable
Queue
SortedList
Stack