Class ObservableTimedObjectsCollection
Provides a collection which can be observed for changes via CollectionChanged event.
Inherited Members
Namespace: Melanchall.DryWetMidi.Interaction
Assembly: Melanchall.DryWetMidi.dll
Syntax
public sealed class ObservableTimedObjectsCollection : IObservableTimedObjectsCollection, IEnumerable<ITimedObject>, IEnumerable
Constructors
ObservableTimedObjectsCollection()
Initializes an empty instance of the ObservableTimedObjectsCollection.
Declaration
public ObservableTimedObjectsCollection()
ObservableTimedObjectsCollection(IEnumerable<ITimedObject>)
Initializes a new instance of the ObservableTimedObjectsCollection with
the specified objects.
Declaration
public ObservableTimedObjectsCollection(IEnumerable<ITimedObject> timedObjects)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ITimedObject> | timedObjects | Objects to add to the collection. |
Properties
Count
Gets the number of objects currently contained in the collection.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
Add(params ITimedObject[])
Adds the specified objects to the current collection.
Declaration
public void Add(params ITimedObject[] objects)
Parameters
| Type | Name | Description |
|---|---|---|
| ITimedObject[] | objects | Objects to add to the collection. |
Remarks
If the method is executed within the ChangeCollection(Action),
the CollectionChanged event will be fired when you're done with
the ChangeCollection(Action) method.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | objects is null. |
Add(IEnumerable<ITimedObject>)
Adds the specified objects to the current collection.
Declaration
public void Add(IEnumerable<ITimedObject> objects)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ITimedObject> | objects | Objects to add to the collection. |
Remarks
If the method is executed within the ChangeCollection(Action),
the CollectionChanged event will be fired when you're done with
the ChangeCollection(Action) method.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | objects is null. |
ChangeCollection(Action)
Executes a specified action that modifies the collection.
Declaration
public void ChangeCollection(Action change)
Parameters
| Type | Name | Description |
|---|---|---|
| Action | change | An Action that performs the modifications to the collection. |
Remarks
If the collection is already undergoing a batch operation, the CollectionChanged
event will not be raised until the outermost operation completes. This ensures that multiple changes can be
grouped together and processed as a single batch.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | change is null. |
ChangeObject(ITimedObject, Action<ITimedObject>)
Executes an action that modifies the specified object.
Declaration
public void ChangeObject(ITimedObject timedObject, Action<ITimedObject> change)
Parameters
| Type | Name | Description |
|---|---|---|
| ITimedObject | timedObject | The object to be modified. |
| Action<ITimedObject> | change | An Action that performs the modifications to the timedObject. |
Remarks
If the method is executed within the ChangeCollection(Action),
the CollectionChanged event will be fired when you're done with
the ChangeCollection(Action) method.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | One of the following errors occurred:
|
Clear()
Removes all objects from the current collection.
Declaration
public void Clear()
Remarks
If the method is executed within the ChangeCollection(Action),
the CollectionChanged event will be fired when you're done with
the ChangeCollection(Action) method.
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<ITimedObject> GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator<ITimedObject> | An enumerator that can be used to iterate through the collection. |
Remove(params ITimedObject[])
Removes the specified objects from the current collection.
Declaration
public bool Remove(params ITimedObject[] objects)
Parameters
| Type | Name | Description |
|---|---|---|
| ITimedObject[] | objects | Objects to remove from the collection. |
Returns
| Type | Description |
|---|---|
| bool |
Remarks
If the method is executed within the ChangeCollection(Action),
the CollectionChanged event will be fired when you're done with
the ChangeCollection(Action) method.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | objects is null. |
Remove(IEnumerable<ITimedObject>)
Removes the specified objects from the current collection.
Declaration
public bool Remove(IEnumerable<ITimedObject> objects)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<ITimedObject> | objects | Objects to remove from the collection. |
Returns
| Type | Description |
|---|---|
| bool |
Remarks
If the method is executed within the ChangeCollection(Action),
the CollectionChanged event will be fired when you're done with
the ChangeCollection(Action) method.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | objects is null. |
Events
CollectionChanged
Occurs when collection changed (objects have been added, removed or changed).
Declaration
public event EventHandler<ObservableTimedObjectsCollectionChangedEventArgs> CollectionChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<ObservableTimedObjectsCollectionChangedEventArgs> |
Implements
Extension Methods
Splitter.SplitObjectsByStep(IEnumerable<ITimedObject>, ITimeSpan, TempoMap, Predicate<ITimedObject>)