public virtual ICollection Keys { get; } public virtual ICollection Values { get; }
SortedList.
Hashtable, "-" SortedList DictionaryEntry, , , , SortedList.
SortedList. , Hashtable, SortedList. , , .
// SortedList.
Using System;
Using System.Collections;
class SLDemo { static void Main() {
// .
SortedList si = new SortedList();
// .
si.Add("", " ");
si.Add("", " ");
si.Add("", " ");
si.Add("", " ");
// , si[""] = " ";
// .
ICollection = si.Keys;
// .
Console.WriteLine(" ."); foreach(string str in )
Console.WriteLine(str + ": " + si[str]);
Console.WriteLine();
// , .
Console.WriteLine(" ."); for(int i=0; i < si.Count; i++)
Console.WriteLine(si.GetBylndex(i));
Console.WriteLine();
// .
Console.WriteLine(" ."); foreach(string str in )
Console.WriteLine(str + ": " + si.IndexOfKey(str));
}
}
.
, : : : : :
.
.
:
: 1
: 2
: 3
: 4
Stack
, , " ". , . , , . . , , , ,
|
|
, , Stack. ICollection, IEnumerable ICloneable. , . , , .
Stack .
Public Stack()
public Stack(int initialCapacity) public Stack(ICollection col)
, , , initialCapacity, , col. .
Stack , , , . . 25.7. . , Push (). , Pop (). , , (). Pop () (), , InvalidOperationException.
25.7. , Stack