zoukankan      html  css  js  c++  java
  • c#笔记(六)——数组

    数组定义,数组初始化:动态初始化,静态初始化
    int[ ] array=new int[6];   new 是运算符;数值类型初始值为0,bool类型是false,字符串初始值null.
    动态初始化:数据类型[] 数组名=new 数据类型[数组长度]{元素1,元素2};
    //数组的动态初始化
                int[] array = new int[6] { 1, 2, 3, 4, 5, 6 };
                int[] arr1 = new int[] { 1, 2, 3, 4, 5, 6 };
                //数组的静态初始化,只能写在一行
                //int[] arr2 = { 7, 8, 9, 10, 11, 12 };
                //int i = 0;
                //Console.WriteLine(arr1[i]);
                //i++;
                //Console.WriteLine(arr1[i]);
                //Console.WriteLine(arr1.Length);
                for (int i = 0; i < arr1.Length; i++)
                {
                    Console.WriteLine(arr1[i]);
                }
      Console.ReadKey();
  • 相关阅读:
    Vue 介绍
    Django 组件-分页器
    Django 组件content_type
    DRF 解析器组件
    Django
    Django 组件-ModelForm
    Django 组件-用户认证
    Django 组件-中间件
    Django 组件-cookie与session
    Django CBV与FBV
  • 原文地址:https://www.cnblogs.com/ningyongbin/p/5922141.html
Copyright © 2011-2022 走看看