Share via


Quantity Property

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Gets or sets the number of units associated with the current line item. This value must represent a whole number.

Namespace:  Microsoft.CommerceServer.Runtime.Orders
Assembly:  Microsoft.CommerceServer.Runtime (in Microsoft.CommerceServer.Runtime.dll)

Syntax

'Declaration
Public Property Quantity As Decimal
'Usage
Dim instance As LineItem
Dim value As Decimal

value = instance.Quantity

instance.Quantity = value
public decimal Quantity { get; set; }
public:
property Decimal Quantity {
    Decimal get ();
    void set (Decimal value);
}
public function get Quantity () : decimal
public function set Quantity (value : decimal)

Property Value

Type: System..::.Decimal
The number of units associated with the current instance. Cannot be less than zero.

Exceptions

Exception Condition
ArgumentException

The value being set is less than zero. Assign Quantity a value greater than or equal to zero to prevent this exception.

InvalidOperationException

quantity is not a whole number.

Remarks

Stores the number of units associated with the current line item. This value must represent a whole number. It is possible to have multiple instances of the same line item in a LineItemCollection. Add does not combine duplicate instances so the quantity for line items added using this method are not added together. Use Add to combine line items. This will cause the quantity of the duplicate line items to be added together under a single line item.

This value must represent a whole number. If you attempt to set the Quantity to a fractional value commerce Server will throw an InvalidCatalogOperationException.

Permissions

See Also

Reference

LineItem Class

LineItem Members

Microsoft.CommerceServer.Runtime.Orders Namespace