[This is preliminary documentation and is subject to change.]
Adds a new item to the list.
Namespace: Tools.CollectionsT.GenericTAssembly: Tools (in Tools.dll) Version: 1.5.3.38916 (1.5.3.38916)
Syntax
| C# |
|---|
public virtual T AddNew() |
| Visual Basic |
|---|
Public Overridable Function AddNew As T |
| Visual C++ |
|---|
public:
virtual T AddNew() |
| F# |
|---|
abstract AddNew : unit -> 'T
override AddNew : unit -> 'T |
| JScript |
|---|
public function AddNew() : T |
Return Value
The item added to the list.
Remarks
Exceptions
| Exception | Condition |
|---|
| System..::..NotSupportedException | AllowNew is false. |
| System..::..ArgumentException | T is not a RuntimeType. -or- T is an open generic type (that is, the ContainsGenericParameters property returns true). |
| System..::..NotSupportedException | T cannot be a TypeBuilder. -or- Creation of TypedReference, ArgIterator, Void, and RuntimeArgumentHandle types, or arrays of those types, is not supported. |
| System.Reflection..::..TargetInvocationException | The constructor of T being called throws an exception. |
| System..::..MethodAccessException | The caller does not have permission to call defualt constructor of T. |
| System..::..MemberAccessException | Cannot create an instance of an abstract class, or this member was invoked with a late-binding mechanism. |
| System.Runtime.InteropServices..::..InvalidComObjectException | The COM type was not obtained through Overload:GetTypeFromProgID(String) or Overload:GetTypeFromCLSID(Guid). |
| System..::..MissingMethodException | No matching public constructor was found. |
| System.Runtime.InteropServices..::..COMException | T is a COM object but the class identifier used to obtain the type is invalid, or the identified class is not registered. |
| System..::..InvalidOperationException | Locked is True |
| System..::..OperationCanceledException | Operation is canceled in eventhandler and CancelError is true |
| System..::..Exception | Any Exception can be thrown by event handler of the Adding event -or- Any excption may be thrown by OnAdding(ICollection, Nullable<(Of <<'(Int32>)>>), Boolean) when AllowItemCancel is true. |
See Also