Class ConfigurationElementCollectionBase<T>
Represents a base class for configuration elements containing a collection of child elements.
Inheritance
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 |
---|---|
Boolean |
Item[Int32]
Returns the element from this collection by index.
Declaration
public T this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index within this collection. |
Property Value
Type | Description |
---|---|
T | The ConfigurationElement. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if the specified index is out of range. |
ArgumentNullException | Thrown if the specified item is a null reference. |
Methods
Add(T)
Adds new ConfigurationElement to this collection.
Declaration
public void Add(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The ConfigurationElement to add. |
Exceptions
Type | Condition |
---|---|
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 ConfigurationElement.
Declaration
public bool Contains(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The ConfigurationElement to search for. |
Returns
Type | Description |
---|---|
Boolean | True if the specified element was found, false otherwise. |
Exceptions
Type | Condition |
---|---|
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. |
Int32 | arrayIndex | The zero-based index in array at which copying begins. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the specified array is a null reference. |
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 |
---|---|---|
ConfigurationElement | element | The ConfigurationElement to return the key for. |
Returns
Type | Description |
---|---|
Object | An object that acts as the key for the specified ConfigurationElement. |
Exceptions
Type | Condition |
---|---|
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 |
---|---|
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 ConfigurationElement to search for. |
Returns
Type | Description |
---|---|
Int32 | Index of the specified element in the collection, or -1, if item was not found. |
Exceptions
Type | Condition |
---|---|
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 |
---|---|---|
Int32 | index | Index in the collection where element needs to be added. |
T | item | The ConfigurationElement to be added. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if the specified item is a null reference. |
ArgumentOutOfRangeException | Thrown if the specified index is out of range. |
Remove(T)
Removes the specified ConfigurationElement from this collection.
Declaration
public bool Remove(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The ConfigurationElement to remove. |
Returns
Type | Description |
---|---|
Boolean | True if element was removed, false otherwise. |
Exceptions
Type | Condition |
---|---|
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 |
---|---|---|
Int32 | index | Index in the collection which points to an element that needs to be removed. |
Exceptions
Type | Condition |
---|---|
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 |
---|---|---|
XmlWriter | writer | Output stream that writes XML to the configuration file. |
Boolean | serializeCollectionKey | True to serialize the collection key; otherwise, false. |
Returns
Type | Description |
---|---|
Boolean | True if the System.Configuration.ConfigurationElementCollection was written to the configuration file successfully. |