📜  c# list - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:16.801000             🧑  作者: Mango

代码示例6
using System;
using System.Collections.Generic;

namespace main {
    class Program {
        private static void Main(string[] args) {
            // syntax: List name = new List();
            List integerList = new List();
            for (int i = 0; i < 10; i++) {
                // add item to list
                integerList.Add(i);
            }
            for (int i = 0; i < 10; i++) {
                // print list item
                Console.WriteLine(integerList[i]);
            }
        }
    }
}