ToList(); ienumerable = Enumerable.Range(0, 1000); } public void RunAsArray() { var query = array.Where(i => i % 2 == 0); foreach (var i in query){} } public void RunAsList() { var query = list.Where(i => i % 2 == 0); foreach (var i in query){} } public ...
classStudent{publicstring name;publicint age;publicStudent(string name,int age){this.name=name;this.age=age;}}voidStart(){List<Student>studentList=newList<Student>();studentList.Add(newStudent("小Y",20));studentList.Add(newStudent("小小Y",10));studentList.Add(newStudent("Y",30));studen...
string str = arr[1]; Debug.Log("end"); Debug.Log("start"); List<string> arr = null; string str = arr[1]; Debug.Log("end"); 2.2 一般数组越界的情况 Array越界报IndexOutOfRangeException List越界报ArgumentOutOfRangeException Debug.Log("start"); string[] arr = { "A" }; string str ...
private string sectionName; 2.键值对: private Dictionary<string, string> m_dicKeyValue; 在IniFile类里面维护一个头部列表缓存: 3.private List<IniSection> m_sectionList; 在从文件中加载的时候初始化他,也就是LoadFromFile()方法里面,初始化所有头部的数据。 IniFile.cs: 1 2 3 4 5 6 7 8 9 10 11...
foreach (string key in new List<string>(dic.Keys)) { result = dic[key]; if (result.Count == 1) { info.Add($"{key}={result[0]}"); continue; } foreach (string value in result)//如果存在相同的文件名称在不同的路径当中
string str = EduGlobalData.CONST_PlayerNumDesc + i; //将玩家的所有角色的数据存储到PlayerPrefs里,如名字、头像的名称、性别、职业、等级、当前经验值等等 Player pl = GetPlayerFromID(i); if (pl != null) { PlayerPrefs.SetInt(str, i);
// outlineInfoList = ServiceManager.Instance().GetAllTree(); // allTreeViewItemList = new List<TreeViewItem>(); // TreeViewItem item1 = new TreeViewItem(); // for (int i = 0; i < outlineInfoList.Count; i++) // { // if (string.IsNullOrEmpty(outlineInfoList[i].ParentId) |...
(RootName); //获取根节点下的第一个节点 XmlNode rootChild = root.FirstChild; XmlNodeList elementList = null; XmlElement element = (XmlElement)root.FirstChild; //判断根节点下的第一个节点是否存在 if (element != null) { element.SetAttribute("PlayerGold", PlayerGold.ToString()); element....
//在List中的元素对象必须继承于IComparer,而且实现了 CompareTo()方法, //基本上所有的值类型都有,也包括string等第一种 .sort() //基于自定义的类实现第二种 .sort(IComparer<T>) 第三种 .sort(IComparison<T>) //是第二种形式的扩展,可以规定排序范围第四种 .sort(int32,int32,IComparer<T>) /...
publicstringa2; } 而且它这个只能替换相同数据结构,假如我想GameObject放到List里也不行了。。。所以我写了一个批量赋值的工具。把MonoBehaviour和ScriptableObject以泛型的形式传进去,让旧的数据等于新的数据、然后在类里把就把旧的变量直接删除掉就好了。