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

不变的集合

并发集合


管道应用并发集合类


相关推荐
看浪的路人1 天前
第10讲:运维 Agent——从「被动救火」到「自动驾驶」
c#·linq
Jazz_z1 天前
C# 实现 Word 文档内容复制
开发语言·c#·word
huaqianzkh2 天前
WMI 查询入门到实战:从概念、WQL 语法到 C# 采集系统与硬件信息完整示例
开发语言·c#
2395730492 天前
Avalonia 12 代码编辑器性能横评:TKCode.Arc CodeEditor vs AvaloniaEdit 12.0(含深度调优实战)
c#·.net·avalonia·codeeditor·tkcode.arc
张人玉4 天前
C#如何使用FreeSql连接数据库
数据库·c#·freesql
吴可可1235 天前
C#打断多段线实现方法
c#
Kari115 天前
医药和制造行业的外文文档批量翻译,排版怎么保住?
开发语言·c#·制造
Warson_L6 天前
.NET 8 速成笔记 1:用 VS Code 做 C# / .NET 开发
c#·.net
Warson_L6 天前
.NET 8 速成笔记 9:C# 项目常见场景(基础设施篇)
c#·.net
Warson_L6 天前
.NET 8 速成笔记 8:C# 项目常见业务场景与写法(数据与业务篇)
c#·.net