London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Class Collection<T>

Represents collection with change tracking.

Implements
System.Collections.Generic.IList<T>
System.Collections.Generic.ICollection<T>
System.Collections.IList
System.Collections.ICollection
System.Collections.Generic.IReadOnlyList<T>
System.Collections.Generic.IReadOnlyCollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
Inherited Members
System.Collections.ObjectModel.Collection<T>.Add(T)
System.Collections.ObjectModel.Collection<T>.Clear()
System.Collections.ObjectModel.Collection<T>.CopyTo(T[], System.Int32)
System.Collections.ObjectModel.Collection<T>.Contains(T)
System.Collections.ObjectModel.Collection<T>.GetEnumerator()
System.Collections.ObjectModel.Collection<T>.IndexOf(T)
System.Collections.ObjectModel.Collection<T>.Insert(System.Int32, T)
System.Collections.ObjectModel.Collection<T>.Remove(T)
System.Collections.ObjectModel.Collection<T>.RemoveAt(System.Int32)
System.Collections.ObjectModel.Collection<T>.System.Collections.IEnumerable.GetEnumerator()
System.Collections.ObjectModel.Collection<T>.System.Collections.ICollection.CopyTo(System.Array, System.Int32)
System.Collections.ObjectModel.Collection<T>.System.Collections.IList.get_Item(System.Int32)
System.Collections.ObjectModel.Collection<T>.System.Collections.IList.set_Item(System.Int32, System.Object)
System.Collections.ObjectModel.Collection<T>.System.Collections.IList.Add(System.Object)
System.Collections.ObjectModel.Collection<T>.System.Collections.IList.Contains(System.Object)
System.Collections.ObjectModel.Collection<T>.System.Collections.IList.IndexOf(System.Object)
System.Collections.ObjectModel.Collection<T>.System.Collections.IList.Insert(System.Int32, System.Object)
System.Collections.ObjectModel.Collection<T>.System.Collections.IList.Remove(System.Object)
System.Collections.ObjectModel.Collection<T>.Count
System.Collections.ObjectModel.Collection<T>.Items
System.Collections.ObjectModel.Collection<T>.Item[System.Int32]
System.Collections.ObjectModel.Collection<T>.System.Collections.Generic.ICollection<T>.IsReadOnly
System.Collections.ObjectModel.Collection<T>.System.Collections.ICollection.IsSynchronized
System.Collections.ObjectModel.Collection<T>.System.Collections.ICollection.SyncRoot
System.Collections.ObjectModel.Collection<T>.System.Collections.IList.Item[System.Int32]
System.Collections.ObjectModel.Collection<T>.System.Collections.IList.IsReadOnly
System.Collections.ObjectModel.Collection<T>.System.Collections.IList.IsFixedSize
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Mediachase.BusinessFoundation.Data
Assembly: Mediachase.BusinessFoundation.Data.dll
Version: 13.30.0
Syntax
public class Collection<T> : Collection<T>, IList<T>, ICollection<T>, IList, ICollection, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable, IChangeTracking
Type Parameters
Name Description
T

Constructors

Collection()

Initializes a new instance of the Collection<T> class.

Declaration
public Collection()

Properties

IsChanged

Gets a value indicating whether this instance is changed.

Declaration
protected virtual bool IsChanged { get; set; }
Property Value
Type Description
System.Boolean

true if this instance is changed; otherwise, false.

Methods

AcceptChanges()

Accepts the changes.

Declaration
protected virtual void AcceptChanges()

AddRange(IEnumerable<T>)

Adds the range.

Declaration
public virtual void AddRange(IEnumerable<T> collection)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<T> collection

The collection.

ClearItems()

Removes all elements from the System.Collections.ObjectModel.Collection<T>.

Declaration
protected override void ClearItems()
Overrides
System.Collections.ObjectModel.Collection<T>.ClearItems()

InsertItem(Int32, T)

Inserts the item.

Declaration
protected override void InsertItem(int index, T item)
Parameters
Type Name Description
System.Int32 index

The index.

T item

The object to insert. The value can be null for reference types.

Overrides
System.Collections.ObjectModel.Collection<T>.InsertItem(System.Int32, T)
Exceptions
Type Condition
System.ArgumentOutOfRangeException

index is less than zero.-or-index is greater than System.Collections.ObjectModel.Collection<T>.Count.

OnChanged(CollectionChangedEventArgs<T>)

Called when [changed].

Declaration
protected virtual void OnChanged(CollectionChangedEventArgs<T> argument)
Parameters
Type Name Description
CollectionChangedEventArgs<T> argument

The argument.

OnChanging(CollectionChangedEventArgs<T>)

Called when [changing].

Declaration
protected virtual void OnChanging(CollectionChangedEventArgs<T> argument)
Parameters
Type Name Description
CollectionChangedEventArgs<T> argument

The argument.

RemoveItem(Int32)

Removes the element at the specified index of the System.Collections.ObjectModel.Collection<T>.

Declaration
protected override void RemoveItem(int index)
Parameters
Type Name Description
System.Int32 index

The zero-based index of the element to remove.

Overrides
System.Collections.ObjectModel.Collection<T>.RemoveItem(System.Int32)
Exceptions
Type Condition
System.ArgumentOutOfRangeException

index is less than zero.-or-index is equal to or greater than System.Collections.ObjectModel.Collection<T>.Count.

SetItem(Int32, T)

Sets the item.

Declaration
protected override void SetItem(int index, T item)
Parameters
Type Name Description
System.Int32 index

The index.

T item

The new value for the element at the specified index. The value can be null for reference types.

Overrides
System.Collections.ObjectModel.Collection<T>.SetItem(System.Int32, T)
Exceptions
Type Condition
System.ArgumentOutOfRangeException

index is less than zero.-or-index is greater than System.Collections.ObjectModel.Collection<T>.Count.

ToArray()

Toes the array.

Declaration
public virtual T[] ToArray()
Returns
Type Description
T[]

Events

Changed

Declaration
public event EventHandler<CollectionChangedEventArgs<T>> Changed
Event Type
Type Description
System.EventHandler<CollectionChangedEventArgs<T>>

Changing

Declaration
public event EventHandler<CollectionChangedEventArgs<T>> Changing
Event Type
Type Description
System.EventHandler<CollectionChangedEventArgs<T>>

Explicit Interface Implementations

IChangeTracking.AcceptChanges()

Accepts the changes.

Declaration
void IChangeTracking.AcceptChanges()

IChangeTracking.IsChanged

Gets a value indicating whether this instance is changed.

Declaration
bool IChangeTracking.IsChanged { get; }
Returns
Type Description
System.Boolean

true if this instance is changed; otherwise, false.

Implements

System.Collections.Generic.IList<T>
System.Collections.Generic.ICollection<T>
System.Collections.IList
System.Collections.ICollection
System.Collections.Generic.IReadOnlyList<T>
System.Collections.Generic.IReadOnlyCollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable