Table of Contents

Class ModuleCollection

Namespace
Loehnert.Lisrt.Modules
Assembly
Loehnert.Lisrt.Modules.dll

Represents an observable collection for ILisrtModule instances.

public class ModuleCollection : ILisrtModuleCollection, ICollection<ILisrtModule>, IEnumerable<ILisrtModule>, IEnumerable, INotifyCollectionChanged
Inheritance
ModuleCollection
Implements
Derived
Inherited Members
Extension Methods

Constructors

ModuleCollection(ICompositeModule)

Initializes a new instance of the ModuleCollection class.

public ModuleCollection(ICompositeModule module)

Parameters

module ICompositeModule

The ICompositeModule instance the collection belongs to.

Exceptions

ArgumentNullException

Thrown when module is null.

ModuleCollection(ICompositeModule, params ILisrtModule[])

Initializes a new instance of the ModuleCollection class and adds subModules.

public ModuleCollection(ICompositeModule module, params ILisrtModule[] subModules)

Parameters

module ICompositeModule

The ICompositeModule instance the collection belongs to.

subModules ILisrtModule[]

ICompositeModules which will be added while construction.

Exceptions

ArgumentNullException

Thrown when module or subModules is null.

Properties

Count

Gets the number of elements.

public int Count { get; }

Property Value

int

IsReadOnly

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

public virtual bool IsReadOnly { get; }

Property Value

bool

this[string]

Gets the LisrtModule element associated with the specified key.

public ILisrtModule this[string key] { get; }

Parameters

key string

The key is case and culture invariant.

Property Value

ILisrtModule

The ILisrtModule associated with the specified key.

Exceptions

ArgumentNullException

Thrown when key is null.

KeyNotFoundException

Thrown when the specified key is not found.

Methods

Add(ILisrtModule)

Adds an ILisrtModule item.

public void Add(ILisrtModule module)

Parameters

module ILisrtModule

The ILisrtModule which should be added.

Exceptions

ArgumentNullException

Thrown when module is null.

NotSupportedException

Thrown when the collection is read only.

ArgumentException

Thrown when the collection already contains a ILisrtModule instance with the name of module.

FormatException

Thrown when Name property contains a dot('.').

Clear()

Removes all ILisrtModule items.

public void Clear()

Contains(ILisrtModule)

Determines whether a sequence contains a specified element by using the default equality comparer.

public bool Contains(ILisrtModule module)

Parameters

module ILisrtModule

The ILisrtModule which should be searched.

Returns

bool

True, if the ModuleCollection contains this element.

ContainsKey(string)

Determines whether a sequence contains a specified element by using the default equality comparer.

public bool ContainsKey(string moduleName)

Parameters

moduleName string

The name of a ILisrtModule which should be searched.

Returns

bool

True, if the ModuleCollection contains an element with this key.

Exceptions

ArgumentNullException

Thrown when moduleName is null or empty.

CopyTo(ILisrtModule[], int)

Copies the elements of the ModuleCollection to an Array.

public void CopyTo(ILisrtModule[] array, int arrayIndex)

Parameters

array ILisrtModule[]

The one-dimensional Array that is the destination of the elements copied from ICollection.

arrayIndex int

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

Exceptions

ArgumentNullException

Thrown when array is null.

GetEnumerator()

Returns an enumerator that iterates through the ModuleCollection.

public IEnumerator<ILisrtModule> GetEnumerator()

Returns

IEnumerator<ILisrtModule>

The collection as IEnumerator.

Remove(ILisrtModule)

Removes the module form the collection.

public bool Remove(ILisrtModule module)

Parameters

module ILisrtModule

The ILisrtModule which should be removed from the collection.

Returns

bool

true if the element is successfully found and removed; otherwise, false.

Exceptions

ArgumentNullException

Thrown when module is null.

Events

CollectionChanged

Occurs when the collection changes.

public event NotifyCollectionChangedEventHandler CollectionChanged

Event Type

NotifyCollectionChangedEventHandler