接口 ICollection 在 C# 中的作用是什么
C# 中的 ICollection 接口定义所有非泛型集合的大小、枚举器和同步方法。它是 System.Collections 命名空间中类的基本接口。
以下是 ICollection 接口的属性 -
| 序号 | 属性名称和描述 |
|---|---|
| 1 | Count ICollection 中元素的数量 |
| 2 | SyncRoot 获取一个有助于同步对 ICollection 的访问的对象。 |
以下是 ICollection 接口的方法 -
| 序号 | 方法名称和描述 |
|---|---|
| 1 | CopyTo(Array^, Int32) 此方法将 ICollection 的元素复制到一个数组。 |
| 2 | GetEnumerator() GetEnumerator() 方法返回一个枚举器,该枚举器遍历集合 |
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
安卓
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP