zoukankan      html  css  js  c++  java
  • 第二十一章;泛型List

    泛型的模板:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace 泛型List
    {
        /// <summary>
        /// 泛型List
        /// </summary>
        class Program
        {
            static void Main(string[] args)
            {
                //实例化类:
                Student student = new Student() { ld=1,Name="小王"};
                Student student2 = new Student() { ld = 2, Name = "小里" };
                Student student3 = new Student() { ld = 3, Name = "小达" };
                Student student4 = new Student() { ld = 4, Name = "小噶" };
    
                //list 其实就是多个Student
                //泛型List的使用
                List<Student> stuList = new List<Student>();
                stuList.Add(student);
                stuList.Add(student2);
                stuList.Add(student3);
                stuList.Add(student4);
    
                Console.ReadKey();
    
    
            }
        }
        public class Student
        {
            public int ld { get; set; }
            public string Name { get; set; }
        }
    }
  • 相关阅读:
    owlsuddimatchmaker安装
    类集
    jsp基本语法
    心得思路记录下
    nyoj517 最小公倍数
    poj1250 Tanning Salon
    poj1686 Lazy Math Instructor
    poj3250 Bad Hair Day
    poj1047 Round and Round We Go
    poj2359 Questions
  • 原文地址:https://www.cnblogs.com/wangqiangya/p/13062579.html
Copyright © 2011-2022 走看看