位数组
可观察的集合
csharp
private ObservableCollection<string> strList = new ObservableCollection<string>();
// Start is called before the first frame update
void Start()
{
strList.CollectionChanged += Change;
strList.Add("ssss");
strList.Add("wwwww");
strList.Insert(1,"eeee");
strList.RemoveAt(1);
}
public void Change(object send,NotifyCollectionChangedEventArgs e)
{
Debug.Log("数组执行的操作是"+e.Action);
if (e.OldItems != null)
{
foreach (var item in e.OldItems)
{
Debug.Log("数组删去的元素" + item);
}
}
if (e.NewItems != null)
{
foreach (var item in e.NewItems)
{
Debug.Log("数组增加的元素" + item);
}
}
}
不变的集合
并发集合
管道应用并发集合类