using System.Collections; using System.Collections.Generic; using UnityEngine; public struct data_data { public data_data(string name, string nickname) { this.Name = name; this.NickName = nickname; } public string Name { get; private set; } public string NickName { get; private set; } } public class struct_example : MonoBehaviour { Listlist = new List (); // Use this for initialization void Start () { list.Add(new data_data("小名", "名仔")); list.Add(new data_data("蠟筆小新", "小新")); //--------- print for (int x = 0; x < list.Count; x++) Debug.Log(list[x].Name +"," + list[x].NickName); } }
2018年4月14日 星期六
struct List 範例
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言