泛型的模板:
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; } } }