O'Reilly logo

C# in a Nutshell by Peter Drayton, Ted Neward, Ben Albahari

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

ICollection

Synopsis

This interface defines the basic characteristics of collection objects and implements three properties. Count gets the number of elements contained in a collection; IsSynchronized indicates whether the collection is thread-safe, and SyncRoot returns an object that synchronizes access to the collection (this is the object itself if the implementing class does not provide a Synchronized() method). ICollection also implements the CopyTo() method for copying elements to an Array object at a specified index.

public interface ICollection : IEnumerable {
// Public Instance Properties
   public field int Count{get; } 
   public field bool IsSynchronized{get; } 
   public field object SyncRoot{get; } 
// Public Instance Methods
   public method void CopyTo(Array array, int index);  
}

Implemented By

Multiple types

Returned By

Multiple types

Passed To

ArrayList.{AddRange(), ArrayList(), InsertRange(), SetRange()}, Queue.Queue(), Stack.Stack()

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required