c#-特殊的集合

位数组



可观察的集合

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);
           }
       }
    }

不变的集合

并发集合


管道应用并发集合类


相关推荐
Charles_go9 小时前
C#中级8、什么是缓存
开发语言·缓存·c#
用户83562907805119 小时前
如何在 C# 中自动化生成 PDF 表格
后端·c#
mudtools21 小时前
.NET如何快速集成飞书API的最佳实践
c#·.net·飞书
ThreePointsHeat1 天前
Unity 关于打包WebGL + jslib录制RenderTexture画面
unity·c#·webgl
a***97681 天前
如何使用C#与SQL Server数据库进行交互
数据库·c#·交互
乘乘凉1 天前
C#中的值传递和引用传递
java·开发语言·c#
BuHuaX1 天前
Unity_AssetBundle相关
unity·c#·游戏引擎·游戏策划
William_cl1 天前
C# ASP.NET Controller 核心:ViewResult 实战指南(return View (model) 全解析)
开发语言·c#·asp.net
周杰伦fans1 天前
CommunityToolkit.Mvvm(又称MVVM Toolkit) 与 MvvmLight 的核心区别
开发语言·c#·.netcore
William_cl1 天前
C# ASP.NET Controller 核心:PartialViewResult 实战指南(AJAX 局部刷新全解析)
ajax·c#·asp.net