Class KeyedByTypeCollection<TItem>
Provides a collection whose items are types that serve as keys.
Inheritance
Inherited Members
Namespace: ExtendedXmlSerializer.Core
Assembly: ExtendedXmlSerializer.dll
Syntax
public class KeyedByTypeCollection<TItem> : KeyedCollection<Type, TItem>, IList<TItem>, ICollection<TItem>, IReadOnlyList<TItem>, IReadOnlyCollection<TItem>, IEnumerable<TItem>, IList, ICollection, IEnumerable
Type Parameters
TItem
The item types contained in the collection that also serve as the keys for the collection. |
Constructors
KeyedByTypeCollection()
Initializes a new instance of the System.Collections.Generic.KeyedByTypeCollection`1 class.
Declaration
[UsedImplicitly]
public KeyedByTypeCollection()
KeyedByTypeCollection(IEnumerable<TItem>)
Initializes a new instance of the System.Collections.Generic.KeyedByTypeCollection`1 class for a specified enumeration of objects.
Declaration
public KeyedByTypeCollection(IEnumerable<TItem> items)
Parameters
System.Collections.Generic.IEnumerable<TItem>
items
The System.Collections.Generic.IEnumerable<T> of generic type System.Object used to initialize the collection. |
Exceptions
System.ArgumentNullException
|
Methods
AddOrReplace<T>(T)
Adds or replaces the given element.
Declaration
public KeyedByTypeCollection<TItem> AddOrReplace<T>(T item)
Parameters
T
item
The item to add or replace. |
Returns
KeyedByTypeCollection<TItem>
The containing collection. |
Type Parameters
T
The element type. |
GetKeyForItem(TItem)
Gets the type of an item contained in the collection.
Declaration
protected sealed override Type GetKeyForItem(TItem item)
Parameters
TItem
item
The item in the collection whose type is to be retrieved. |
Returns
System.Type
The type of the specified |
Overrides
Exceptions
System.ArgumentNullException
|
InsertItem(Int32, TItem)
Inserts an element into the collection at a specific location.
Declaration
protected sealed override void InsertItem(int index, TItem item)
Parameters
System.Int32
index
The zero-based index at which |
TItem
item
The object to insert into the collection. |
Overrides
Exceptions
System.ArgumentNullException
|
Remove<T>(T)
Removes an object of a specified type from the collection.
Declaration
public bool Remove<T>(T item)
Parameters
T
item
|
Returns
System.Boolean
The object removed from the collection. |
Type Parameters
T
The type of item in the collection to remove. |
RemoveAll<T>()
Removes all of the elements of a specified type from the collection.
Declaration
public KeyedByTypeCollection<TItem> RemoveAll<T>()
Returns
KeyedByTypeCollection<TItem>
The System.Collections.ObjectModel.Collection<T> that contains the objects of the referenced type from the original collection. |
Type Parameters
T
The referenced type of item in the collection to remove. |
SetItem(Int32, TItem)
Replaces the item at the specified index with a new object.
Declaration
protected sealed override void SetItem(int index, TItem item)
Parameters
System.Int32
index
The zero-based index of the |
TItem
item
The object to add to the collection. |
Overrides
Exceptions
System.ArgumentNullException
|