Table of Contents

Class AppenderCollection

Namespace
log4net.Appender
Assembly
log4net.dll

A strongly-typed collection of IAppender objects.

public class AppenderCollection : IList, ICollection, ICloneable, ICollection<IAppender>, IEnumerable<IAppender>, IEnumerable
Inheritance
AppenderCollection
Implements
Inherited Members

Constructors

AppenderCollection()

Initializes a new instance of the AppenderCollection class that is empty and has the default initial capacity.

public AppenderCollection()

AppenderCollection(ICollection)

Initializes a new instance of the AppenderCollection class that contains elements copied from the specified IAppender collection.

[SuppressMessage("Usage", "CA2214:Do not call overridable methods in constructors")]
public AppenderCollection(ICollection collection)

Parameters

collection ICollection

The IAppender collection whose elements are copied to the new list.

AppenderCollection(int)

Initializes a new instance of the AppenderCollection class that has the specified initial capacity.

public AppenderCollection(int capacity)

Parameters

capacity int

The number of elements that the new AppenderCollection is initially capable of storing.

AppenderCollection(AppenderCollection)

Initializes a new instance of the AppenderCollection class that contains elements copied from the specified AppenderCollection.

[SuppressMessage("Usage", "CA2214:Do not call overridable methods in constructors")]
public AppenderCollection(AppenderCollection collection)

Parameters

collection AppenderCollection

The AppenderCollection whose elements are copied to the new collection.

AppenderCollection(IAppender[])

Initializes a new instance of the AppenderCollection class that contains elements copied from the specified IAppender array.

[SuppressMessage("Usage", "CA2214:Do not call overridable methods in constructors")]
public AppenderCollection(IAppender[] array)

Parameters

array IAppender[]

The IAppender array whose elements are copied to the new list.

Fields

EmptyCollection

An empty readonly static AppenderCollection

public static readonly AppenderCollection EmptyCollection

Field Value

AppenderCollection

Properties

Capacity

Gets or sets the number of elements the AppenderCollection can contain.

public virtual int Capacity { get; set; }

Property Value

int

Count

Gets the number of elements actually contained in the AppenderCollection.

public virtual int Count { get; }

Property Value

int

IsFixedSize

Gets a value indicating whether the collection has a fixed size.

public virtual bool IsFixedSize { get; }

Property Value

bool

true if the collection has a fixed size; otherwise, false. The default is false

IsReadOnly

Gets a value indicating whether the IList is read-only.

public virtual bool IsReadOnly { get; }

Property Value

bool

true if the collection is read-only; otherwise, false. The default is false

IsSynchronized

Gets a value indicating whether access to the collection is synchronized (thread-safe).

public virtual bool IsSynchronized { get; }

Property Value

bool

false, because the backing type is an array, which is never thread-safe.

this[int]

Gets or sets the IAppender at the specified index.

public virtual IAppender this[int index] { get; set; }

Parameters

index int

The zero-based index of the element to get or set.

Property Value

IAppender

Exceptions

ArgumentOutOfRangeException

index is less than zero

-or-

index is equal to or greater than Count.

SyncRoot

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

public virtual object SyncRoot { get; }

Property Value

object

Methods

Add(IAppender)

Adds a IAppender to the end of the AppenderCollection.

public virtual int Add(IAppender item)

Parameters

item IAppender

The IAppender to be added to the end of the AppenderCollection.

Returns

int

The new Count

AddRange(ICollection)

Adds the elements of a IAppender collection to the current AppenderCollection.

public virtual int AddRange(ICollection collection)

Parameters

collection ICollection

The IAppender collection whose elements should be added to the end of the AppenderCollection.

Returns

int

The new Count of the AppenderCollection.

AddRange(AppenderCollection)

Adds the elements of another AppenderCollection to the current AppenderCollection.

public virtual int AddRange(AppenderCollection collection)

Parameters

collection AppenderCollection

The AppenderCollection whose elements should be added to the end of the current AppenderCollection.

Returns

int

The new Count of the AppenderCollection.

AddRange(IAppender[])

Adds the elements of a IAppender array to the current AppenderCollection.

public virtual int AddRange(IAppender[] array)

Parameters

array IAppender[]

The IAppender array whose elements should be added to the end of the AppenderCollection.

Returns

int

The new Count of the AppenderCollection.

Clear()

Removes all elements from the AppenderCollection.

public virtual void Clear()

Clone()

Creates a shallow copy of the AppenderCollection.

public virtual object Clone()

Returns

object

A new AppenderCollection with a shallow copy of the collection data.

Contains(IAppender)

Determines whether a given IAppender is in the AppenderCollection.

public virtual bool Contains(IAppender item)

Parameters

item IAppender

The IAppender to check for.

Returns

bool

true if item is found in the AppenderCollection; otherwise, false.

CopyTo(IAppender[])

Copies the entire AppenderCollection to a one-dimensional IAppender array.

public virtual void CopyTo(IAppender[] array)

Parameters

array IAppender[]

The one-dimensional IAppender array to copy to.

CopyTo(IAppender[], int)

Copies the entire AppenderCollection to a one-dimensional IAppender array, starting at the specified index of the target array.

public virtual void CopyTo(IAppender[] array, int index)

Parameters

array IAppender[]

The one-dimensional IAppender array to copy to.

index int

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

GetEnumerator()

Returns an enumerator that can iterate through the AppenderCollection.

public virtual IEnumerator<IAppender> GetEnumerator()

Returns

IEnumerator<IAppender>

An AppenderCollection.Enumerator for the entire AppenderCollection.

IndexOf(IAppender)

Returns the zero-based index of the first occurrence of a IAppender in the AppenderCollection.

public virtual int IndexOf(IAppender item)

Parameters

item IAppender

The IAppender to locate in the AppenderCollection.

Returns

int

The zero-based index of the first occurrence of item in the entire AppenderCollection, if found; otherwise, -1.

Insert(int, IAppender)

Inserts an element into the AppenderCollection at the specified index.

public virtual void Insert(int index, IAppender item)

Parameters

index int

The zero-based index at which item should be inserted.

item IAppender

The IAppender to insert.

Exceptions

ArgumentOutOfRangeException

index is less than zero

-or-

index is equal to or greater than Count.

ReadOnly(AppenderCollection)

Creates a read-only wrapper for a AppenderCollection instance.

public static AppenderCollection ReadOnly(AppenderCollection list)

Parameters

list AppenderCollection

list to create a readonly wrapper around

Returns

AppenderCollection

An AppenderCollection wrapper that is read-only.

Remove(IAppender)

Removes the first occurrence of a specific IAppender from the AppenderCollection.

public virtual void Remove(IAppender item)

Parameters

item IAppender

The IAppender to remove from the AppenderCollection.

Exceptions

ArgumentException

The specified IAppender was not found in the AppenderCollection.

RemoveAt(int)

Removes the element at the specified index of the AppenderCollection.

public virtual void RemoveAt(int index)

Parameters

index int

The zero-based index of the element to remove.

Exceptions

ArgumentOutOfRangeException

index is less than zero

-or-

index is equal to or greater than Count.

ToArray()

Return the collection elements as an array

public virtual IAppender[] ToArray()

Returns

IAppender[]

the array

TrimToSize()

Sets the capacity to the actual number of elements.

public virtual void TrimToSize()