2010/03/18

C# week8_2


16/03/2010


 

Collection

collection : temporary data
data base : permanent data

 

Arraylist

Pros.
  • more efficient than array (extend, minimize = flexible)
  • arraylist can have different datatype, such as int, string and ocject of the class.

 

Arraylist al = new Arraylist();
al.Add(5);
al.Add(10);
al.Remove(5);

 
foreach

foreach(<type> <variable> in <list>)
*The list must be same datatype.

 
Hashtable

Hashtable hash = new Hashtable();
("key", "value")
hash.Containts
hash.ContaintsValue
*Remove only key

 

Stack k = new Stack();


 

Queue days = new Queue();


 

0 件のコメント:

コメントを投稿

UA-9417263-1