SortedList.GetValueList : SortedList « System.Collections « C# / C Sharp by API






SortedList.GetValueList

  

using System;
using System.Collections;

class MainClass
{

  public static void Main()
  {
    SortedList mySortedList = new SortedList();

    mySortedList.Add("NY", "New York");
    mySortedList.Add("FL", "Florida");
    mySortedList.Add("AL", "Alabama");
    mySortedList.Add("WY", "Wyoming");
    mySortedList.Add("CA", "California");

    foreach (string myKey in mySortedList.Keys)
    {
      Console.WriteLine("myKey = " + myKey);
    }

    foreach(string myValue in mySortedList.Values)
    {
      Console.WriteLine("myValue = " + myValue);
    }
    Console.WriteLine("Getting the value list");
    IList myValueList = mySortedList.GetValueList();
    foreach(string myValue in myValueList)
    {
      Console.WriteLine("myValue = " + myValue);
    }
  }
}

   
    
  








Related examples in the same category

1.SortedList.Add
2.SortedList.ContainsValue()
3.SortedList.Count
4.SortedList.GetByIndex
5.SortedList.GetKey
6.SortedList.GetKeyList
7.SortedList.IndexOfKey
8.SortedList.Keys
9.SortedList.Remove
10.SortedList.RemoveAt
11.SortedList.Values