Home  >  Article  >  Backend Development  >  What is the role of the ICollection interface in C#

What is the role of the ICollection interface in C#

WBOY
WBOYforward
2023-09-09 16:33:04770browse

C# 中 ICollection 接口的作用是什么

In C#, the ICollection interface defines the size, enumerators and synchronization methods of all non-generic collections. It is the basic interface for classes in the System.Collections namespace.

The following are the properties of the ICollection interface:

Serial number Property name and description
1 Count

#Number of elements in ICollection

2 SyncRoot

Get an object for synchronous access to ICollection.

The following are the methods of the ICollection interface:

##12
Serial number Method name and description
CopyTo(Array^,Int32)This method copies the elements of ICollection into an array.

GetEnumerator()The GetEnumerator() method returns a collection for iteration enumerator.

The above is the detailed content of What is the role of the ICollection interface in C#. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete
Previous article:Queue interface in C#Next article:Queue interface in C#