• 用类名声明数组


    用类声明的数组对象,相当于一个包含不同对象名的数组

    using System;
    using System.Collections.Generic;
    using System.Text;

    namespace _3_7Lesson
    {
      class Person
      {
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public override string ToString()
        {
          return string.Format
          ("Person:FirstName={0},LastName={1}", FirstName, LastName);
        }
        public Person()
        {
        }
      }

      class Program
      {
        static void Main(string[] args)
        {

            Person [] myperson = new Person [2];

            myperson[0] = new Person { FirstName = "audi", LastName = "senna" };
            Person person1 = myperson [0];
            Console.WriteLine(myperson[0].ToString ());
          Console.ReadKey();
        }
      }


    }

    温故知新,方便自己回顾使用
  • 相关阅读:
    js入门
    小程序事件处理
    Vue组件传递数据
    Vue+webpack
    vue总结
    Vue指令
    最优化练习题
    最优化学习笔记
    概率与统计分析练习题
    概率与统计分析学习笔记
  • 原文地址:https://www.cnblogs.com/zjka/p/10488631.html
Copyright © 2020-2023  润新知