c#数组的声明

点击查看代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            //1
            int[] numsOne = new int[10];
            for(int i=0; i<numsOne.Length; i++)
            {
                numsOne[i] = i + 1;
            }

            //2
            int[] numsTwo = { 1, 2, 3, 4, 5 };

            //3
            int[] numsThree = new int[3] { 1, 2, 3 };

            //4
            int[] numsFour = new int[] { 1, 2, 3, 4, 5, 6 };
        }
    }
}

posted @ 2025-08-30 14:09  双Mz  阅读(2)  评论(0)    收藏  举报