Show / Hide Table of Contents

Class ObservableCollection<T>

Implements an Observable collection of Items.

Inheritance
System.Object
ObservableCollection<T>
Implements
IReadOnlyList<T>
ICollection<T>
IReadOnlyCollection<T>
IList
ICollection
IEnumerable<T>
IEnumerable
IAtomProvider
Namespace: Cortex.Net.Types
Assembly: Cortex.Net.dll
Syntax
public sealed class ObservableCollection<T> : IList<T>, IReadOnlyList<T>, ICollection<T>, IReadOnlyCollection<T>, IList, ICollection, IEnumerable<T>, IEnumerable, IAtomProvider
Type Parameters
Name Description
T

The type parameter to work on.

Constructors

| Improve this Doc View Source

ObservableCollection(ISharedState, IEnhancer, IEnumerable<T>, String)

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

Declaration
public ObservableCollection(ISharedState sharedState, IEnhancer enhancer, IEnumerable<T> initialValues, string name = null)
Parameters
Type Name Description
ISharedState sharedState

The ISharedState instance this observableCollection belongs to.

IEnhancer enhancer

The IEnhancer implementation to use.

IEnumerable<T> initialValues

The initial values to use.

System.String name

The name of the ObservableCollection.

| Improve this Doc View Source

ObservableCollection(ISharedState, IEnhancer, String)

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

Declaration
public ObservableCollection(ISharedState sharedState, IEnhancer enhancer, string name = null)
Parameters
Type Name Description
ISharedState sharedState

The ISharedState instance this observableCollection belongs to.

IEnhancer enhancer

The IEnhancer implementation to use.

System.String name

The name of the ObservableCollection.

Properties

| Improve this Doc View Source

Count

Gets the number of elements contained in the ObservableCollection<T>.

Declaration
public int Count { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

IsFixedSize

Gets a value indicating whether the ObservableCollection<T> has a fixed size.

Declaration
public bool IsFixedSize { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsReadOnly

Gets a value indicating whether the ObservableCollection<T> is read-only.

Declaration
public bool IsReadOnly { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsSynchronized

Gets a value indicating whether access to the ObservableCollection<T> is synchronized (thread safe).

Declaration
public bool IsSynchronized { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

Item[Int32]

Gets or sets the element at the specified index.

Declaration
public T this[int index] { get; set; }
Parameters
Type Name Description
System.Int32 index

The zero-based index of the element to get or set.

Property Value
Type Description
T

The element at the specified index.

| Improve this Doc View Source

Name

Gets the name of the ObservableCollection<T>.

Declaration
public string Name { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

SharedState

Gets the shared state this ObservableCollection<T> operates on.

Declaration
public ISharedState SharedState { get; }
Property Value
Type Description
ISharedState
| Improve this Doc View Source

SyncRoot

Gets an object that can be used to synchronize access to the ObservableCollection<T>.

Declaration
public object SyncRoot { get; }
Property Value
Type Description
System.Object

Methods

| Improve this Doc View Source

Add(T)

Adds an item to the ObservableCollection<T>.

Declaration
public void Add(T item)
Parameters
Type Name Description
T item

The object to add to the ObservableCollection<T>.

| Improve this Doc View Source

Clear()

Removes all elements from the ObservableCollection<T>.

Declaration
public void Clear()
| Improve this Doc View Source

Contains(T)

Determines whether the ObservableCollection<T> contains a specific value.

Declaration
public bool Contains(T item)
Parameters
Type Name Description
T item

The object to locate in the ObservableCollection<T>.

Returns
Type Description
System.Boolean

true if item is found in the ObservableCollection<T>; otherwise, false.

| Improve this Doc View Source

CopyTo(T[], Int32)

Copies the elements of the ObservableCollection<T> to an System.Array, starting at a particular System.Array index.

Declaration
public void CopyTo(T[] array, int arrayIndex)
Parameters
Type Name Description
T[] array

The one-dimensional System.Array that is the destination of the elements copied from ObservableCollection<T>. The System.Array must have zero-based indexing.

System.Int32 arrayIndex

The zero-based index in array at which copying begins.

| Improve this Doc View Source

GetEnumerator()

Returns an enumerator that iterates through the ObservableCollection<T>.

Declaration
public IEnumerator<T> GetEnumerator()
Returns
Type Description
IEnumerator<T>

An enumerator that can be used to iterate through the ObservableCollection<T>.

| Improve this Doc View Source

IndexOf(T)

Searches for the specified object and returns the zero-based index of the first occurrence within the entire ObservableCollection<T>.

Declaration
public int IndexOf(T item)
Parameters
Type Name Description
T item

The object to locate in the System.Collections.Generic.List`1. The value can be null for reference types.

Returns
Type Description
System.Int32

The zero-based index of the first occurrence of item within the entire ObservableCollection<T>, if found; otherwise, –1.

| Improve this Doc View Source

Insert(Int32, T)

Inserts an item to the ObservableCollection<T> at the specified index.

Declaration
public void Insert(int index, T item)
Parameters
Type Name Description
System.Int32 index

The zero-based index at which item should be inserted.

T item

The object to insert into the ObservableCollection<T>.

| Improve this Doc View Source

Remove(T)

Removes the first occurrence of a specific object from the ObservableCollection<T>.

Declaration
public bool Remove(T item)
Parameters
Type Name Description
T item

The object to remove from the ObservableCollection<T>. The value can be null for reference types.

Returns
Type Description
System.Boolean

True if item is successfully removed; otherwise, false. This method also returns false if item was not found in the ObservableCollection<T>.

| Improve this Doc View Source

RemoveAt(Int32)

Removes the ObservableCollection<T> item at the specified index.

Declaration
public void RemoveAt(int index)
Parameters
Type Name Description
System.Int32 index

The zero-based index of the item to remove.

Events

| Improve this Doc View Source

Change

Event that fires before the value will change.

Declaration
public event EventHandler<ObservableCollectionCancellableEventArgs> Change
Event Type
Type Description
EventHandler<ObservableCollectionCancellableEventArgs>
| Improve this Doc View Source

Changed

Event that fires after the value has changed.

Declaration
public event EventHandler<ObservableCollectionEventArgs> Changed
Event Type
Type Description
EventHandler<ObservableCollectionEventArgs>

Explicit Interface Implementations

| Improve this Doc View Source

IAtomProvider.Atom

Gets the atom.

Declaration
IAtom IAtomProvider.Atom { get; }
Returns
Type Description
IAtom

Implements

IReadOnlyList<>
ICollection<>
IReadOnlyCollection<>
IList
ICollection
IEnumerable<>
IEnumerable
IAtomProvider

Extension Methods

TraceExtensions.Trace<TObject, TMember>(TObject, Expression<Func<TObject, TMember>>, TraceMode)
ReactiveObjectTypeUtilExtensions.GetObservable(Object)
ReactiveObjectTypeUtilExtensions.GetObservable<TObject, TMember>(TObject, Expression<Func<TObject, TMember>>)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX