ObservableBindingListTAddNew Method

Adds a new item to the collection.

Definition

Namespace: KGySoft.ComponentModel
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 7.0.0
C#
public T AddNew()

Return Value

T
The item added to the list.

Remarks

If AllowNew returns , then an InvalidOperationException will be thrown.

Otherwise, if the underlying list implements IBindingList, then its AddNew implementation will be called.

Otherwise, if T is a value type or has a parameterless constructor, then a new item of T is created and added to the list.

Otherwise, an InvalidOperationException will be thrown.

Exceptions

InvalidOperationExceptionThe AllowNew property returns
-or-
The underlying collection could not add the new item, and T is not a value type or has no parameterless constructor.

See Also