NamedObjects<T>
Provides a dictionary-based collection of named objects with change notification and item replacement events.
Definition
Namespace:Telerik.Windows.Documents.Spreadsheet.Core
Assembly:Telerik.Windows.Documents.Spreadsheet.dll
Type Parameters:
T
The type of the T.
Syntax:
public class NamedObjects<T> : IEnumerable where T : INamedObject
Inheritance: objectNamedObjects<T>
Implements:
Constructors
Initializes a new instance of the NamedObjects<T> class.
public NamedObjects()
Properties
Gets the total number of items in the collection.
public int Count { get; }
The count.
Methods
Adds the specified item.
public void Add(T item)
The new item.
Adds multiple items to the collection in a single update scope, raising Changed once after all additions.
public void AddRange(IEnumerable<T> items)
The range of items.
Removes all items from the collection and raises the Changed event.
public void Clear()
Determines whether the specified item is contained in the collection.
Retrieves the item with the specified name, throwing an exception if not found.
public T GetByName(string name)
The name of the searched item.
Returns:T
The searched item.
Returns an enumerator that iterates through the collection.
public IEnumerator<T> GetEnumerator()
IEnumerator<T>
A IEnumerator<T> that can be used to iterate through the collection.
Called when the collection is changed.
protected virtual void OnChanged()
Raises the event.
protected virtual void OnItemReplaced(NamedObjectsItemReplaceEventArgs args)
The NamedObjectsItemReplaceEventArgs instance containing the event data.
Removes the item with the specified name from the collection and raises the Changed event.
Replaces the item with the specified name with a new item, raising ItemReplaced and Changed events.
public void Replace(string itemName, T item)
Name of the item to replace.
itemTThe item to replace with.
Events
Raised after items are added, removed, or cleared, unless change events are suspended.
public event EventHandler Changed
Raised when an item is replaced via the Replace method, providing old and new item names.
public event EventHandler<NamedObjectsItemReplaceEventArgs> ItemReplaced