public TValue this[TKey key ] { get; set;
}.
,
.
, .
SortedList<TKey, TValueX
. SortedList.
// // SortedList<TKey, TValue>.
Using System;
Using System.Collections.Generic;
class GenSLDemo {
static void Main() {
// // .
SortedList<string, double> si =
new SortedList<string, double>();
// , si.Add(", ", 73000); si.Add(", Capa", 59000); si.Add(", ", 45000); si.Add(", ", 99000);
// , .. .
ICollection<string> = si.Keys;
// , .. , foreach(string str in )
Console.WriteLine("{0}, : {1:C}", str, si[str]);
Console.WriteLine();
}
}
.
, , : $73,000.00 , , : $45,000.00 , , : $99,000.00 , , : $59,000.00
, , .
Stack<T>
Stack<T> Stack. , " ". Collection, IEnumerable IEnumerable<T>. , Stack<T> Clear(),Contains() , ICollection<T>. Add () Remove () , , , IsReadOnly. Stack<T> , , , . Stack<T> .
Public Stack()
public Stack(int capacity)
public Stack(IEnumerable<T> collection)
, , capaci ty. , , collection. .
|
|
Stack<T> , , , , ICollection<T>. . 25.20. Stack, . , Push (). , Pop (). , , (). Pop () (), , InvalidOperationException.
25.20. , Stack<T>
Public
T Peek()
, ,
Public
T Pop()
, ,
Public
void Push(T item)
i tern
Public
T[] ToArrayO
,
Public
Void TrimExcessO
Stack<T>.
// Stack<T>. using System;