ObservableCollection<T> Constructors

Definition

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

Overloads

ObservableCollection<T>()

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

ObservableCollection<T>(IEnumerable<T>)

Initializes a new instance of the ObservableCollection<T> class that contains elements copied from the specified collection.

ObservableCollection<T>(List<T>)

Initializes a new instance of the ObservableCollection<T> class that contains elements copied from the specified list.

ObservableCollection<T>()

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

public:
 ObservableCollection();
public ObservableCollection ();
Public Sub New ()

Applies to

ObservableCollection<T>(IEnumerable<T>)

Initializes a new instance of the ObservableCollection<T> class that contains elements copied from the specified collection.

public:
 ObservableCollection(System::Collections::Generic::IEnumerable<T> ^ collection);
public ObservableCollection (System.Collections.Generic.IEnumerable<T> collection);
new System.Collections.ObjectModel.ObservableCollection<'T> : seq<'T> -> System.Collections.ObjectModel.ObservableCollection<'T>
Public Sub New (collection As IEnumerable(Of T))

Parameters

collection
IEnumerable<T>

The collection from which the elements are copied.

Exceptions

The collection parameter cannot be null.

Remarks

The elements are copied onto the ObservableCollection<T> in the same order they are read by the enumerator of the collection.

Applies to

ObservableCollection<T>(List<T>)

Initializes a new instance of the ObservableCollection<T> class that contains elements copied from the specified list.

public:
 ObservableCollection(System::Collections::Generic::List<T> ^ list);
public ObservableCollection (System.Collections.Generic.List<T> list);
new System.Collections.ObjectModel.ObservableCollection<'T> : System.Collections.Generic.List<'T> -> System.Collections.ObjectModel.ObservableCollection<'T>
Public Sub New (list As List(Of T))

Parameters

list
List<T>

The list from which the elements are copied.

Exceptions

The list parameter cannot be null.

Remarks

The elements are copied onto the ObservableCollection<T> in the same order they are read by the enumerator of the list.

Applies to