Declaring an array:
string[] names = new string[5];There are two ways you can assign values to an array. The first is to assign the values individually by specify the index of the array inside a square bracket. The index is the position of element in the array. Index starts with 0.
names[0] = "George"; names[1] = "James"; names[2] = "Arthur"; names[3] = "Eric"; names[4] = "Jennifer";
Or you can initialize and populate the array at the same time, like the example below.
string[] names = new string[]{"George","James","Arthur","Eric","Jennifer"};You don't have to specify the size of the array if you initialize during the declaration, C# is smart enough to figure out the array size from the initialization. You can loop through an array with a foreach loop
foreach(string n in names) { Response.Write(n + ""); }Or a for loop
for(int i=0; i < names.Length;i++) { Response.Write(n + ""); }
Đặt vé máy bay tại Aivivu, tham khảo
ReplyDeleteve may bay di my gia re
vé máy bay từ mỹ về việt nam 2021
chuyến bay thương mại từ canada về việt nam
có chuyến bay từ nhật về việt nam chưa
vé máy bay hàn quốc hà nội
Vé máy bay từ Đài Loan về VN
chi phi ve may bay cho chuyen gia nuoc ngoai