In This Article

SimpleObservableCollection<T> Class

Provides a generic collection that provides notifications when items are added or removed.

public class SimpleObservableCollection<T> : Collection<T>, IList<T>, ICollection<T>, IList, ICollection, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable where T : class
Type Parameters:
T -

The type of collection item.

Inheritance:
System.Object System.Collections.ObjectModel.Collection<T> Object
Derived:
StructureMatchResultCollection LexicalScopeCollection SearchPatternProviderCollection KeyedObservableCollection<T> SimpleSynchronizedCollection<T>

Constructors

SimpleObservableCollection()

public SimpleObservableCollection()

Properties

IsReadOnly

Gets whether the collection is allowed to be modified.

public virtual bool IsReadOnly { get; }

Property Value

System.Boolean:

true if the collection is allowed to be modified; otherwise, false.

Methods

BlockReentrancy()

Disallows reentrant attempts to change this collection.

protected IDisposable BlockReentrancy()

Returns

System.IDisposable:

An System.IDisposable object that can be used to dispose of the object.

CheckReadOnly()

Throws an exception if the collection is read-only.

protected virtual void CheckReadOnly()

CheckReentrancy()

Checks for reentrant attempts to change this collection.

protected void CheckReentrancy()

ClearItems()

Removes all items from the collection.

protected override void ClearItems()

InsertItem(Int32, T)

Inserts an item into the collection at the specified index.

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

The index at which to insert the item.

item T

The item to insert.

OnItemAdded(Int32, T)

Called after an item as been added into the collection.

protected virtual void OnItemAdded(int index, T value)
Parameter Type Description
index System.Int32

The index at which the item is added.

value T

The item that is added.

OnItemAdding(Int32, T)

Called before an item as been added into the collection.

protected virtual void OnItemAdding(int index, T value)
Parameter Type Description
index System.Int32

The index at which the item is added.

value T

The item that is added.

OnItemRemoved(Int32, T)

Called after an item has been removed from the collection.

protected virtual void OnItemRemoved(int index, T value)
Parameter Type Description
index System.Int32

The index at which the item is removed.

value T

The item that is removed.

OnItemRemoving(Int32, T)

Called before an item has been removed from the collection.

protected virtual void OnItemRemoving(int index, T value)
Parameter Type Description
index System.Int32

The index at which the item is removed.

value T

The item that is removed.

RemoveItem(Int32)

Removes the item at the specified index.

protected override void RemoveItem(int index)
Parameter Type Description
index System.Int32

The index of the item to remove.

SetItem(Int32, T)

Replaces the item at the specified index.

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

The index of the item to replace.

item T

The item with which to replace.

Events

ItemAdded

Occurs after an item is added to the collection.

public event EventHandler<CollectionChangeEventArgs<T>> ItemAdded

Event Type

System.EventHandler<CollectionChangeEventArgs<T>>

ItemAdding

Occurs before an item is added to the collection.

public event EventHandler<CollectionChangeEventArgs<T>> ItemAdding

Event Type

System.EventHandler<CollectionChangeEventArgs<T>>

ItemRemoved

Occurs after an item is removed from the collection.

public event EventHandler<CollectionChangeEventArgs<T>> ItemRemoved

Event Type

System.EventHandler<CollectionChangeEventArgs<T>>

ItemRemoving

Occurs before an item is removed from the collection.

public event EventHandler<CollectionChangeEventArgs<T>> ItemRemoving

Event Type

System.EventHandler<CollectionChangeEventArgs<T>>

Inherited Members

  • 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()

Extension Methods