特殊集合和结构体
||栈 stact
stact ss=new stact();
ss.push(3);
ss.push(5);
ss.push(7);
console.writeline(ss.peek());\\读取最后一个元素
console.writeline(ss.pop());\\读取并移除最后一个元素
ss.count;
ss.clear;
ss.contains(7);
object[] shuzu=(object[])ss.toarry();
foreach(int a in shuzu)
{
console.writeline(a);
}
console.readline();
||队列
Queue qu=new Queue();
qu.Enqueue(3);
qu.Enqueue(5);
console.writeline(qu.peek());
console.writeline(qu.dequeue());移除并获取
Hashtable ht=new hashtable();
ht.add("a","zhangsan ");
ht.add("b","lisi");
ht.add("c","wangwu");
\\读取key集合
Icollection htkeys=ht.keys;
console.writeline(htkey.count);
string[] ss=new string [3];
htkeys.copyto(ss,0);
\\读取values 集合
||||||结构体
class 结构体
public student
{
public int code;
public string name;
public string sex;
public decimal height;
}
stactic void main(string [] args)
{
student s=new student ();//初始化 结构体
s.code="101";
s.name="张三";
s.sex=“男”;
s.height="173";
}