zoukankan      html  css  js  c++  java
  • 第四次作业

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApplication5
    {
    class Program
    {
    static void Main(string[] args)
    {
    Employee[] empArray = new Employee[3];

    for (int i = 0; i < empArray.Length; i++)
    {
    empArray[i] = new Employee(i);//构造方法
    }
    for (int j = 0; j < empArray.Length; j++)
    {
    Console.WriteLine(empArray[j].ToString());
    }
    //第一部分


    Tester t = new Tester();
    t.DisplayVals(5, 6, 7, 8);//不需要生成数组,也可以传递需要的参数
    int[] explicitArray = new int[5] { 1, 2, 3, 4, 5 };
    t.DisplayVals(explicitArray);//第二部分

    const int rows = 4; const int columns = 3;
    int[,] rectangularArray = new int[rows, columns];//a个逗号就a+1维
    int[][] jaggedArray1 = new int[2][] { new int[5], new int[8] }; //a个[]代表a维,2代表两行,后面的5和8代表列数
    Console.WriteLine("{0}", jaggedArray1.Length);
    Console.ReadLine();
    }
    }
    }

    public class Employee
    {
    private int empID;
    public Employee(int empID)
    {
    this.empID = empID;
    }
    public override string ToString()
    {
    return empID.ToString();
    }

    }

    public class Tester
    {
    public void DisplayVals(params int[] intVals)
    {
    foreach (int i in intVals)
    {
    Console.WriteLine("DisplayVals {0}", i);
    }
    }
    }

  • 相关阅读:
    day23 笔记
    iframe子页面与父页面通信
    js格式化时间
    自定义滚动条样式
    表格隔行换色
    css除第一个子元素的其他子元素的4种方法,超实用!
    子div在父div里居中
    红橙黄绿蓝靛紫-RGB-十六进制
    阿里巴巴矢量图标库 字体图标的下载与使用
    calc属性不生效
  • 原文地址:https://www.cnblogs.com/zeromaiko/p/4396592.html
Copyright © 2011-2022 走看看