Share via


Current Property

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

Gets the current DiscountItem from the collection.

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

Syntax

'Declaration
Public ReadOnly Property Current As DiscountItem
'Usage
Dim instance As DiscountItemCollectionEnumerator
Dim value As DiscountItem

value = instance.Current
public DiscountItem Current { get; }
public:
property DiscountItem^ Current {
    DiscountItem^ get ();
}
public function get Current () : DiscountItem

Property Value

Type: Microsoft.CommerceServer.Runtime.Marketing..::.DiscountItem
The current DiscountItem object.

Remarks

Gets the element in the collection at the current position of the enumerator.

After an enumerator is created, or after a call to the Reset()()() method, the MoveNext()()() method must be called to advance the enumerator to the first element of the collection before reading the value of the Current property; otherwise, Current is undefined and an exception is thrown.

Current also throws an exception if the last call to MoveNext returned false, which indicates the end of the collection.

Current does not move the position of the enumerator, and consecutive calls to Current return the same object until either MoveNext or Reset is called.

An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is invalidated and becomes irrecoverable; thus, the next call to MoveNext or Reset throws an InvalidOperationException. However, if the collection is modified between calls to MoveNext and Current, Current returns the element that it is set to, even if the enumerator has been invalidated.

Permissions

See Also

Reference

DiscountItemCollectionEnumerator Class

DiscountItemCollectionEnumerator Members

Microsoft.CommerceServer.Runtime.Marketing Namespace