Add Method (LineItem)
Add a specified LineItem to the end of the LineItemCollection.
Namespace: Microsoft.CommerceServer.Runtime.Orders
Assembly: Microsoft.CommerceServer.Runtime (in Microsoft.CommerceServer.Runtime.dll)
Syntax
'Declaration
Public Sub Add ( _
lineItem As LineItem _
)
'Usage
Dim instance As LineItemCollection
Dim lineItem As LineItem
instance.Add(lineItem)
public void Add(
LineItem lineItem
)
public:
void Add(
LineItem^ lineItem
)
public function Add(
lineItem : LineItem
)
Parameters
- lineItem
Type: Microsoft.CommerceServer.Runtime.Orders..::.LineItem
The LineItem to be added. May not be nullNothingnullptra null reference (Nothing in Visual Basic).
Exceptions
Exception | Condition |
---|---|
ConfiguredLimitExceededException | The number of line items within the current instance exceeds the LineItemCountPerOrderFormLimit set in the Web.config file. |
ArgumentNullException | lineItem is nullNothingnullptra null reference (Nothing in Visual Basic). |
ArgumentException | The entry being added is already a member of a collection. |
EntityAlreadyExistsException | A LineItem that matches the new line item is already in the current instance. |
Remarks
Add a LineItem to the end of the LineItemCollection.
Successfully calling Add updates LastModified. Add will not clone the line item being added prior to adding it to the collection. Add will add the line item without checking for an existing duplicate entry. Add will not clone the line item being added prior to adding it to the collection. Calling Add(LineItem) will set the ParentOrderForm, OrderFormId, OrderGroupId, and Index properties.
Permissions
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.