Hashtable.Clear 清除
function Clear () : void
Description描述
Count is set to zero, and references to other objects from elements of the collection are also released.
数量被设置为0,并且从该集合中元素到其他对象的引用也将被释放。
The capacity remains unchanged. This method is an O(n) operation, where n is Hashtable.Count.
容量没有改变。这个方法是O(n)操作,这里n是Hashtable.Count。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public Hashtable h;
public void Awake() {
h = new Hashtable();
h.Add("1", "one");
h.Add("2", "two");
Debug.Log(h.Count);
h.Clear();
Debug.Log(h.Count);
}
}
最后修改:2011年3月10日 Thursday 16:24