📄 program.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace Example14_7 {
class Program {
static void Main(string[] args) {
//创建新的ArrayList对象myArrayList。
List<int> myList = new List<int>();
//向myList添加元素,分别为0,1,2,3,4。
for (int i = 0; i < 5; i++) {
myList.Add(i);
}
//遍历myList,并将相应的元素输出。
foreach (int i in myList) {
//由于类型已限定,此处无须使用转换将对象转换为int类型。
Console.WriteLine(i);
}
Console.ReadLine();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -