Class ConfigurationElementCollectionBase<T>
Represents a base class for configuration elements containing a collection of child elements.
Inheritance
Implements
Namespace: Nevatech.Vsb.Repository.Configuration
Assembly: Nevatech.Vsb.Repository.dll
Syntax
public abstract class ConfigurationElementCollectionBase<T> : ConfigurationElementCollection, IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable where T : ConfigurationElement
Type Parameters
Name | Description |
---|---|
T | The type of the collection item. |
Constructors
ConfigurationElementCollectionBase()
Declaration
protected ConfigurationElementCollectionBase()
Properties
IsReadOnly
Gets a value indicating whether this collection is read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Item[Int32]
Returns the element from this collection by index.
Declaration
public T this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index within this collection. |
Property Value
Type | Description |
---|---|
T | The System.Configuration.ConfigurationElement. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if the specified index is out of range. |
System.ArgumentNullException | Thrown if the specified item is a null reference. |
Methods
Add(T)
Adds new System.Configuration.ConfigurationElement to this collection.
Declaration
public void Add(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The System.Configuration.ConfigurationElement to add. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if the specified item is a null reference. |
Clear()
Removes all elements from this collection.
Declaration
public void Clear()
Contains(T)
Determines whether this collection contains a specific System.Configuration.ConfigurationElement.
Declaration
public bool Contains(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The System.Configuration.ConfigurationElement to search for. |
Returns
Type | Description |
---|---|
System.Boolean | True if the specified element was found, false otherwise. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if the specified item is a null reference. |
CopyTo(T[], Int32)
Copies the elements of this collection to an array, starting at a particular array index.
Declaration
public void CopyTo(T[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
T[] | array | The one-dimensional array that is the destination of the elements copied from this collection. The array must have zero-based indexing. |
System.Int32 | arrayIndex | The zero-based index in array at which copying begins. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if the specified array is a null reference. |
System.ArgumentOutOfRangeException | Thrown if the specified arrayIndex is out of range. |
GetElementKey(ConfigurationElement)
Gets the element key for a specified configuration element.
Declaration
protected override object GetElementKey(ConfigurationElement element)
Parameters
Type | Name | Description |
---|---|---|
System.Configuration.ConfigurationElement | element | The System.Configuration.ConfigurationElement to return the key for. |
Returns
Type | Description |
---|---|
System.Object | An object that acts as the key for the specified System.Configuration.ConfigurationElement. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown, if provided element is not of the collection item type. |
GetEnumerator()
Returns an enumerator that iterates through this collection.
Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<T> | An enumerator that can be used to iterate through the collection. |
IndexOf(T)
Returns index of the specified element in the collection.
Declaration
public int IndexOf(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The System.Configuration.ConfigurationElement to search for. |
Returns
Type | Description |
---|---|
System.Int32 | Index of the specified element in the collection, or -1, if item was not found. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if the specified item is a null reference. |
Insert(Int32, T)
Inserts provided element at the specified index location in the collection.
Declaration
public void Insert(int index, T item)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Index in the collection where element needs to be added. |
T | item | The System.Configuration.ConfigurationElement to be added. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if the specified item is a null reference. |
System.ArgumentOutOfRangeException | Thrown if the specified index is out of range. |
Remove(T)
Removes the specified System.Configuration.ConfigurationElement from this collection.
Declaration
public bool Remove(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The System.Configuration.ConfigurationElement to remove. |
Returns
Type | Description |
---|---|
System.Boolean | True if element was removed, false otherwise. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if the specified item is a null reference. |
RemoveAt(Int32)
Removes element stored in the collection at the specified index location.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Index in the collection which points to an element that needs to be removed. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if the specified index is out of range. |
SerializeElement(XmlWriter, Boolean)
Writes the configuration data to an XML element in the configuration file without emitting <clear/> element.
Declaration
protected override bool SerializeElement(XmlWriter writer, bool serializeCollectionKey)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | writer | Output stream that writes XML to the configuration file. |
System.Boolean | serializeCollectionKey | True to serialize the collection key; otherwise, false. |
Returns
Type | Description |
---|---|
System.Boolean | True if the System.Configuration.ConfigurationElementCollection was written to the configuration file successfully. |