// Hashtable.
Using System;
Using System.Collections;
class HashtableDemo { static void Main() {
// -.
Hashtable ht = new Hashtable ();
// .
ht.Add("", " ");
ht.Add("", " ");
ht.Add("", " ");
ht.Add("", " ");
// , ht [""] = " ";
// .
ICollection = ht.Keys;
// , foreach(string str in )
Console.WriteLine(str + ": " + ht[str]);
}
}
.
: : : : :
, "-" . , - ht. Keys. - ht , . , , IDictionary Hashtable.
SortedList
SortedList , "-" , . SortedList IDictionary, ICollection, IEnumerable ICloneable.
SortedList , .
public SortedList() public SortedList(IDictionary d) public SortedList(int initialCapacity) public SortedList(IComparer comparer)
, . SortedList, d. . SortedList, , initialCapacity. , . , . , .
SortedList . , , . SortedList . , , , .
|
|
SortedList , , , . . 25.6. , , SortedList, Contains Key (). , SortedList, ContainsValue (). SortedList GetEnumerator (), IDict ionar yEnumerator. , IDictionaryEnumerator , , "-". , , SortedList, Synchronized ().
25.6. , SortedList
Public virtual bool
true,
ContainsKey(object key)
SortedList
key,
False
. 25.6
Public virtual bool
true,
ContainsValue(object value)
SortedList
value, false
Public virtual object
,
GetBylndex(int index)
index
Public virtual
IDictionaryEnumerator
SortedList
GetEnumerator()
IDictionaryEnumerator
Public virtual object
,
GetKey(int index)
index
Public virtual IList
SortedList
GetKeyList()
, SortedList
Public virtual IList
SortedList
GetValueList()
, SortedList
Public virtual int
key.
IndexOfKey(object key)
, -1
Public virtual int
IndexOfValue(object value)
value . , -1
Public virtual void
index
SetBylndex(int index, object
|
|
value
value)
Public static SortedList
Synchronized(SortedList list)
SortedList, list
Public virtual void
Capacity
TrimToSize()
Count
. , GetBylndex (), SetBylndex (). Get Key (), GetKeyList (). , GetValueList(). IndexOfKey (), IndexOfValue (). , SortedList , IDictionary .
SortedList , , . Hashtable, , Keys Values,