1. 程式人生 > >C#語法基礎(二)---陣列&&string&&ArrayList

C#語法基礎(二)---陣列&&string&&ArrayList

 

陣列的申請

int[] a = new int[5];//申請一個長度為5的陣列
int[] a = new int[] { 1, 2, 3, 4, 5, 6 };//申請一個數組 直接給他初始化

 

string 的宣告

string str="";//宣告string型別 str 並且賦值為空

 

string陣列的宣告

string[] a = new string[] { "1111111101", "11111111102" };

 

申請隨機數  以及ArrayList的使用

ArrayList的名稱空間     using System.Collections;