Table of Contents

Class EmptyCollection

Namespace
log4net.Util
Assembly
log4net.dll

An always empty ICollection.

public sealed class EmptyCollection : ICollection, IEnumerable
Inheritance
EmptyCollection
Implements
Inherited Members

Remarks

A singleton implementation of the ICollection interface that always represents an empty collection.

Properties

Count

Gets the number of elements contained in the ICollection.

public int Count { get; }

Property Value

int

The number of elements contained in the ICollection.

Remarks

As the collection is empty the Count is always 0.

Instance

Gets the singleton instance of the empty collection.

public static EmptyCollection Instance { get; }

Property Value

EmptyCollection

The singleton instance of the empty collection.

Remarks

Gets the singleton instance of the empty collection.

IsSynchronized

Gets a value indicating if access to the ICollection is synchronized (thread-safe).

public bool IsSynchronized { get; }

Property Value

bool

true if access to the ICollection is synchronized (thread-safe); otherwise, false.

Remarks

For the EmptyCollection this property is always true.

SyncRoot

Gets an object that can be used to synchronize access to the ICollection.

public object SyncRoot { get; }

Property Value

object

An object that can be used to synchronize access to the ICollection.

Remarks

As the collection is empty and thread safe and synchronized this instance is also the SyncRoot object.

Methods

CopyTo(Array, int)

Copies the elements of the ICollection to an Array, starting at a particular Array index.

public void CopyTo(Array array, int index)

Parameters

array Array

The one-dimensional Array that is the destination of the elements copied from ICollection. The Array must have zero-based indexing.

index int

The zero-based index in array at which copying begins.

Remarks

As the collection is empty no values are copied into the array.

GetEnumerator()

Returns an enumerator that can iterate through a collection.

public IEnumerator GetEnumerator()

Returns

IEnumerator

An IEnumerator that can be used to iterate through the collection.

Remarks

As the collection is empty a NullEnumerator is returned.