Class ReferenceCollection
- Namespace
- NMF.Models.Collections
- Assembly
- NMF.Models.dll
Denotes the base class for a collection of referenced elements
public abstract class ReferenceCollection : ICollectionExpression<IModelElement>, IEnumerableExpression<IModelElement>, IEnumerableExpression, ICollection<IModelElement>, IEnumerable<IModelElement>, INotifyCollectionChanged, IList, ICollection, IEnumerable, IDisposable
- Inheritance
-
ReferenceCollection
- Implements
- Derived
- Inherited Members
Properties
Count
Gets the number of elements contained in the ICollection<T>.
public abstract int Count { get; }
Property Value
- int
The number of elements contained in the ICollection<T>.
IsReadOnly
Gets a value indicating whether the ICollection<T> is read-only.
public bool IsReadOnly { get; }
Property Value
- bool
true if the ICollection<T> is read-only; otherwise, false.
Methods
Add(IModelElement)
Adds an item to the ICollection<T>.
public abstract void Add(IModelElement item)
Parameters
itemIModelElementThe object to add to the ICollection<T>.
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
AsNotifiable()
Gets notifications for this collection
public INotifyCollection<IModelElement> AsNotifiable()
Returns
- INotifyCollection<IModelElement>
A collection that will notify clients as new elements change
AttachCore()
Attaches the collection
protected abstract void AttachCore()
Clear()
Removes all items from the ICollection<T>.
public abstract void Clear()
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
Contains(IModelElement)
Determines whether the ICollection<T> contains a specific value.
public abstract bool Contains(IModelElement item)
Parameters
itemIModelElementThe object to locate in the ICollection<T>.
Returns
- bool
true if
itemis found in the ICollection<T>; otherwise, false.
CopyTo(IModelElement[], int)
Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.
public abstract void CopyTo(IModelElement[] array, int arrayIndex)
Parameters
arrayIModelElement[]The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.
arrayIndexintThe zero-based index in
arrayat which copying begins.
Exceptions
- ArgumentNullException
arrayis null.- ArgumentOutOfRangeException
arrayIndexis less than 0.- ArgumentException
The number of elements in the source ICollection<T> is greater than the available space from
arrayIndexto the end of the destinationarray.
DetachCore()
Detaches the collection
protected abstract void DetachCore()
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
protected virtual void Dispose(bool disposing)
Parameters
disposingbool
GetEnumerator()
Returns an enumerator that iterates through the collection.
public abstract IEnumerator<IModelElement> GetEnumerator()
Returns
- IEnumerator<IModelElement>
An enumerator that can be used to iterate through the collection.
OnCollectionChanged(NotifyCollectionChangedEventArgs)
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
Parameters
PropagateCollectionChanges(object, NotifyCollectionChangedEventArgs)
Propagate a collection changed event
protected void PropagateCollectionChanges(object sender, NotifyCollectionChangedEventArgs e)
Parameters
senderobjectThe original sender
eNotifyCollectionChangedEventArgsThe event args
PropagateValueChanges(object, ValueChangedEventArgs)
Propagate a value changed event
protected void PropagateValueChanges(object sender, ValueChangedEventArgs e)
Parameters
senderobjectThe original sender
eValueChangedEventArgsThe original event args
PropagateValueChanges(object, BubbledChangeEventArgs)
Propagates a bubbled change
protected void PropagateValueChanges(object sender, BubbledChangeEventArgs e)
Parameters
senderobjectThe original sender
eBubbledChangeEventArgsThe original event args
Remove(IModelElement)
Removes the first occurrence of a specific object from the ICollection<T>.
public abstract bool Remove(IModelElement item)
Parameters
itemIModelElementThe object to remove from the ICollection<T>.
Returns
- bool
true if
itemwas successfully removed from the ICollection<T>; otherwise, false. This method also returns false ifitemis not found in the original ICollection<T>.
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
Events
CollectionChanged
Occurs when the collection changes.
public event NotifyCollectionChangedEventHandler CollectionChanged