赞
踩
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System.Linq;
-
- /// <summary>
- /// 个人信息
- /// </summary>
- public class PersonInfo
- {
- public int ID;
- public int Age;
- public string Names;
-
- public PersonInfo(int id, int age, string name, List<PersonInfo> temp = null)
- {
- this.ID = id;
- this.Age = age;
- this.Names = name;
- temp?.Add(this);
- }
- }
-
- public class ListTools : MonoBehaviour {
-
- private List<PersonInfo> Persons = new List<PersonInfo>();
-
-
- void Start () {
-
- //一种添加方法
- var a = new PersonInfo(1001, 10, "小东", Persons);
-
- //正常添加方法
- Persons.Add(new PersonInfo(1002, 15, "小马"));
- Persons.Add(new PersonInfo(1003, 20, "小牛"));
- Persons.Add(new PersonInfo(1004, 25, "小洗"));
-
- this.SortType();
- }
-
- public void SortType()
- {
- //

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。