Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Class Collection<T>

Represents collection with change tracking.

Implements
Namespace: Mediachase.BusinessFoundation.Data
Assembly: Mediachase.BusinessFoundation.Data.dll
Version: 14.26.0
Syntax
public class Collection<T> : Collection<T>, 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`1.

Declaration
protected override void 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.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

index is less than zero.-or-index is greater than System.Collections.ObjectModel.Collection`1.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`1.

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

The zero-based index of the element to remove.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

index is less than zero.-or-index is equal to or greater than System.Collections.ObjectModel.Collection`1.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.

Exceptions
Type Condition
System.ArgumentOutOfRangeException

index is less than zero.-or-index is greater than System.Collections.ObjectModel.Collection`1.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