Show / Hide Table of Contents

Class KeyedByTypeCollection<TItem>

Provides a collection whose items are types that serve as keys.

Inheritance
System.Object
System.Collections.ObjectModel.Collection<TItem>
System.Collections.ObjectModel.KeyedCollection<System.Type, TItem>
KeyedByTypeCollection<TItem>
Inherited Members
System.Collections.ObjectModel.KeyedCollection<System.Type, TItem>.ChangeItemKey(TItem, System.Type)
System.Collections.ObjectModel.KeyedCollection<System.Type, TItem>.ClearItems()
System.Collections.ObjectModel.KeyedCollection<System.Type, TItem>.Contains(System.Type)
System.Collections.ObjectModel.KeyedCollection<System.Type, TItem>.GetKeyForItem(TItem)
System.Collections.ObjectModel.KeyedCollection<System.Type, TItem>.InsertItem(System.Int32, TItem)
System.Collections.ObjectModel.KeyedCollection<System.Type, TItem>.Remove(System.Type)
System.Collections.ObjectModel.KeyedCollection<System.Type, TItem>.RemoveItem(System.Int32)
System.Collections.ObjectModel.KeyedCollection<System.Type, TItem>.SetItem(System.Int32, TItem)
System.Collections.ObjectModel.KeyedCollection<System.Type, TItem>.Comparer
System.Collections.ObjectModel.KeyedCollection<System.Type, TItem>.Dictionary
System.Collections.ObjectModel.KeyedCollection<System.Type, TItem>.Item[System.Type]
System.Collections.ObjectModel.Collection<TItem>.System.Collections.IList.get_Item(System.Int32)
System.Collections.ObjectModel.Collection<TItem>.System.Collections.IList.set_Item(System.Int32, System.Object)
System.Collections.ObjectModel.Collection<TItem>.Add(TItem)
System.Collections.ObjectModel.Collection<TItem>.Clear()
System.Collections.ObjectModel.Collection<TItem>.ClearItems()
System.Collections.ObjectModel.Collection<TItem>.Contains(TItem)
System.Collections.ObjectModel.Collection<TItem>.CopyTo(TItem[], System.Int32)
System.Collections.ObjectModel.Collection<TItem>.GetEnumerator()
System.Collections.ObjectModel.Collection<TItem>.IndexOf(TItem)
System.Collections.ObjectModel.Collection<TItem>.Insert(System.Int32, TItem)
System.Collections.ObjectModel.Collection<TItem>.Remove(TItem)
System.Collections.ObjectModel.Collection<TItem>.RemoveAt(System.Int32)
System.Collections.ObjectModel.Collection<TItem>.RemoveItem(System.Int32)
System.Collections.ObjectModel.Collection<TItem>.System.Collections.ICollection.CopyTo(System.Array, System.Int32)
System.Collections.ObjectModel.Collection<TItem>.System.Collections.IEnumerable.GetEnumerator()
System.Collections.ObjectModel.Collection<TItem>.System.Collections.IList.Add(System.Object)
System.Collections.ObjectModel.Collection<TItem>.System.Collections.IList.Contains(System.Object)
System.Collections.ObjectModel.Collection<TItem>.System.Collections.IList.IndexOf(System.Object)
System.Collections.ObjectModel.Collection<TItem>.System.Collections.IList.Insert(System.Int32, System.Object)
System.Collections.ObjectModel.Collection<TItem>.System.Collections.IList.Remove(System.Object)
System.Collections.ObjectModel.Collection<TItem>.Count
System.Collections.ObjectModel.Collection<TItem>.Item[System.Int32]
System.Collections.ObjectModel.Collection<TItem>.Items
System.Collections.ObjectModel.Collection<TItem>.System.Collections.Generic.ICollection<TItem>.IsReadOnly
System.Collections.ObjectModel.Collection<TItem>.System.Collections.ICollection.IsSynchronized
System.Collections.ObjectModel.Collection<TItem>.System.Collections.ICollection.SyncRoot
System.Collections.ObjectModel.Collection<TItem>.System.Collections.IList.IsFixedSize
System.Collections.ObjectModel.Collection<TItem>.System.Collections.IList.IsReadOnly
System.Collections.ObjectModel.Collection<TItem>.System.Collections.IList.Item[System.Int32]
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
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

items is null.

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 item in the collection.

Overrides
System.Collections.ObjectModel.KeyedCollection<System.Type, TItem>.GetKeyForItem(TItem)
Exceptions
System.ArgumentNullException

item is null.

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 item should be inserted.

TItem item

The object to insert into the collection.

Overrides
System.Collections.ObjectModel.KeyedCollection<System.Type, TItem>.InsertItem(System.Int32, TItem)
Exceptions
System.ArgumentNullException

item is null.

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 item to be replaced.

TItem item

The object to add to the collection.

Overrides
System.Collections.ObjectModel.KeyedCollection<System.Type, TItem>.SetItem(System.Int32, TItem)
Exceptions
System.ArgumentNullException

item is null.

Extension Methods

ExtensionMethods.Return<T, TOut>(T, TOut)
ExtensionMethods.Apply<T>(ICollection<T>, T)
ExtensionMethods.Only<T>(IEnumerable<T>)
ExtensionMethods.To<T>(Object)
ExtensionMethods.AsValid<T>(Object, String)
ExtensionMethodsForAttachedProperties.Get<TType, TValue>(TType, Property<TType, TValue>)
ExtensionMethodsForAttachedProperties.Set<TType, TValue>(TType, Property<TType, TValue>, TValue)
ExtensionMethodsForCoreSources.If<TParameter, TResult>(TResult, ISpecification<TParameter>)
ExtensionMethodsForCoreSources.Let<TSpecification, TInstance>(TInstance, ISpecification<TSpecification>, TInstance)

See Also

https://msdn.microsoft.com/en-us/library/ms404549%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396
Back to top Generated by DocFX