ClassNamedObjects<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
NamedObjects()
Initializes a new instance of the NamedObjects<T> class.
Declaration
public NamedObjects()
Properties
Count
Gets the total number of items in the collection.
Methods
Add(T)
Adds the specified item.
Declaration
public void Add(T item)
Parameters
item
T
The new item.
AddRange(IEnumerable<T>)
Adds multiple items to the collection in a single update scope, raising Changed once after all additions.
Declaration
public void AddRange(IEnumerable<T> items)
Parameters
items
IEnumerable<T>
The range of items.
Clear()
Removes all items from the collection and raises the Changed event.
Declaration
public void Clear()
Contains(T)
Determines whether the specified item is contained in the collection.
Declaration
public bool Contains(T item)
Parameters
item
T
The searched item.
Returns
True if contained.
Contains(string)
Determines whether item with the specified name is contained in the collection.
GetByName(string)
Retrieves the item with the specified name, throwing an exception if not found.
Declaration
public T GetByName(string name)
Parameters
name
The name of the searched item.
Returns
T
The searched item.
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<T> GetEnumerator()
Returns
IEnumerator<T>
A IEnumerator<T> that can be used to iterate through the collection.
OnChanged()
Called when the collection is changed.
Declaration
protected virtual void OnChanged()
OnItemReplaced(NamedObjectsItemReplaceEventArgs)
Raises the event.
Declaration
protected virtual void OnItemReplaced(NamedObjectsItemReplaceEventArgs args)
Parameters
args
NamedObjectsItemReplaceEventArgs
The NamedObjectsItemReplaceEventArgs instance containing the event data.
Remove(string)
Removes the item with the specified name from the collection and raises the Changed event.
Declaration
public void Remove(string name)
Parameters
name
The name of the item.
Replace(string, T)
Replaces the item with the specified name with a new item, raising ItemReplaced and Changed events.
Declaration
public void Replace(string itemName, T item)
Parameters
itemName
Name of the item to replace.
item
T
The item to replace with.
TryGetByName(string, out T)
Attempts to retrieve the item with the specified name without throwing an exception if not found.
Events
Changed
Raised after items are added, removed, or cleared, unless change events are suspended.
ItemReplaced
Raised when an item is replaced via the Replace method, providing old and new item names.
Declaration
public event EventHandler<NamedObjectsItemReplaceEventArgs> ItemReplaced
Event Value