Class ModuleCollection
Represents an observable collection for ILisrtModule instances.
Implements
Inherited Members
Namespace: Loehnert.Lisrt.Modules
Assembly: Loehnert.Lisrt.Modules.dll
Syntax
public class ModuleCollection : ILisrtModuleCollection, ICollection<ILisrtModule>, IEnumerable<ILisrtModule>, IEnumerable, INotifyCollectionChanged
Constructors
ModuleCollection(ICompositeModule)
Initializes a new instance of the ModuleCollection class.
Declaration
public ModuleCollection(ICompositeModule module)
Parameters
Type | Name | Description |
---|---|---|
ICompositeModule | module | The ICompositeModule instance the collection belongs to. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
ModuleCollection(ICompositeModule, ILisrtModule[])
Initializes a new instance of the ModuleCollection class and adds subModules
.
Declaration
public ModuleCollection(ICompositeModule module, params ILisrtModule[] subModules)
Parameters
Type | Name | Description |
---|---|---|
ICompositeModule | module | The ICompositeModule instance the collection belongs to. |
ILisrtModule[] | subModules | ICompositeModules which will be added while construction. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
Properties
Count
Gets the number of elements.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
IsReadOnly
Gets a value indicating whether the ModuleCollection is read-only.
Declaration
public virtual bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
Boolean |
Item[String]
Gets the LisrtModule element associated with the specified key.
Declaration
public ILisrtModule this[string key] { get; }
Parameters
Type | Name | Description |
---|---|---|
String | key | The key is case and culture invariant. |
Property Value
Type | Description |
---|---|
ILisrtModule | The ILisrtModule associated with the specified key. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
System.Collections.Generic.KeyNotFoundException | Thrown when the specified |
Methods
Add(ILisrtModule)
Adds an ILisrtModule item.
Declaration
public void Add(ILisrtModule module)
Parameters
Type | Name | Description |
---|---|---|
ILisrtModule | module | The ILisrtModule which should be added. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
System.NotSupportedException | Thrown when the collection is read only. |
System.ArgumentException | Thrown when the collection already contains a ILisrtModule instance with the name of |
System.FormatException | Thrown when Name property contains a dot('.'). |
Clear()
Removes all ILisrtModule items.
Declaration
public void Clear()
Contains(ILisrtModule)
Determines whether a sequence contains a specified element by using the default equality comparer.
Declaration
public bool Contains(ILisrtModule module)
Parameters
Type | Name | Description |
---|---|---|
ILisrtModule | module | The ILisrtModule which should be searched. |
Returns
Type | Description |
---|---|
Boolean | True, if the ModuleCollection contains this element. |
ContainsKey(String)
Determines whether a sequence contains a specified element by using the default equality comparer.
Declaration
public bool ContainsKey(string moduleName)
Parameters
Type | Name | Description |
---|---|---|
String | moduleName | The name of a ILisrtModule which should be searched. |
Returns
Type | Description |
---|---|
Boolean | True, if the ModuleCollection contains an element with this key. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when moduleName is null or empty. |
CopyTo(ILisrtModule[], Int32)
Copies the elements of the ModuleCollection to an System.Array.
Declaration
public void CopyTo(ILisrtModule[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
ILisrtModule[] | array | The one-dimensional System.Array that is the destination of the elements copied from System.Collections.ICollection. |
System.Int32 | arrayIndex | The zero-based index in array at which copying begins. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
GetEnumerator()
Returns an enumerator that iterates through the ModuleCollection.
Declaration
public IEnumerator<ILisrtModule> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<ILisrtModule> | The collection as System.Collections.IEnumerator. |
Remove(ILisrtModule)
Removes the module
form the collection.
Declaration
public bool Remove(ILisrtModule module)
Parameters
Type | Name | Description |
---|---|---|
ILisrtModule | module | The ILisrtModule which should be removed from the collection. |
Returns
Type | Description |
---|---|
Boolean | true if the element is successfully found and removed; otherwise, false. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when |
Events
CollectionChanged
Occurs when the collection changes.
Declaration
public event NotifyCollectionChangedEventHandler CollectionChanged
Event Type
Type | Description |
---|---|
System.Collections.Specialized.NotifyCollectionChangedEventHandler |
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Returns an enumerator that iterates through a collection.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator | An System.Collections.IEnumerator object that can be used to iterate through the collection. |