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

不变的集合

并发集合


管道应用并发集合类


相关推荐
张人玉6 小时前
C#通讯(上位机)常用知识点
开发语言·c#·通讯·上位机开发
武藤一雄8 小时前
C#:nameof 运算符全指南
开发语言·microsoft·c#·.net·.netcore
CSharp精选营9 小时前
聊一聊 C# 中的闭包陷阱:foreach 循环的坑你还记得吗?
c#·foreach·循环·for循环
月巴月巴白勺合鸟月半10 小时前
FHIR 的使用
人工智能·c#·fhir
公子小六10 小时前
基于.NET的Windows窗体编程之WinForms控件简介
windows·microsoft·c#·.net
观无11 小时前
mysql5.7下载地址
c#
武藤一雄11 小时前
C# 核心技术解析:Parse vs TryParse 实战指南
开发语言·windows·microsoft·微软·c#·.netcore
代数狂人12 小时前
在Godot中应用面向对象原则:C#脚本实践
c#·游戏引擎·godot
斌味代码12 小时前
RAG 实战:用 LangChain + DeepSeek 搭建企业私有知识库问答系统
开发语言·langchain·c#
张人玉13 小时前
C#类常用知识总结Pro
服务器·c#