Class AppenderCollection
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
collectionICollectionThe 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
capacityintThe 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
collectionAppenderCollectionThe 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
Fields
EmptyCollection
An empty readonly static AppenderCollection
public static readonly AppenderCollection EmptyCollection
Field Value
Properties
Capacity
Gets or sets the number of elements the AppenderCollection can contain.
public virtual int Capacity { get; set; }
Property Value
Count
Gets the number of elements actually contained in the AppenderCollection.
public virtual int Count { get; }
Property Value
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
indexintThe zero-based index of the element to get or set.
Property Value
Exceptions
- ArgumentOutOfRangeException
indexis less than zero-or-
indexis 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
Methods
Add(IAppender)
Adds a IAppender to the end of the AppenderCollection.
public virtual int Add(IAppender item)
Parameters
itemIAppenderThe IAppender to be added to the end of the AppenderCollection.
Returns
AddRange(ICollection)
Adds the elements of a IAppender collection to the current AppenderCollection.
public virtual int AddRange(ICollection collection)
Parameters
collectionICollectionThe 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
collectionAppenderCollectionThe 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
arrayIAppender[]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
Returns
- bool
true if
itemis 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
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
arrayIAppender[]The one-dimensional IAppender array to copy to.
indexintThe zero-based index in
arrayat 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
itemIAppenderThe IAppender to locate in the AppenderCollection.
Returns
- int
The zero-based index of the first occurrence of
itemin 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
indexintThe zero-based index at which
itemshould be inserted.itemIAppenderThe IAppender to insert.
Exceptions
- ArgumentOutOfRangeException
indexis less than zero-or-
indexis equal to or greater than Count.
ReadOnly(AppenderCollection)
Creates a read-only wrapper for a AppenderCollection instance.
public static AppenderCollection ReadOnly(AppenderCollection list)
Parameters
listAppenderCollectionlist 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
itemIAppenderThe 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
indexintThe zero-based index of the element to remove.
Exceptions
- ArgumentOutOfRangeException
indexis less than zero-or-
indexis 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()