Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

PriorityQueue.Offer Method

Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions.

[Visual Basic]
Public Overrides Sub Offer( _
   ByVal objectToAdd As Object _
) _
    Implements IQueue.Offer
[C#]
public override bool Offer(
   object objectToAdd
);

Parameters

objectToAdd
The element to add.

Return Value

if the element was added to this queue.

Implements

IQueue.Offer

Remarks

When using a capacity-restricted queue, this method is generally preferable to Add, which can fail to insert an element only by throwing an exception.

Exceptions

Exception Type Condition
InvalidCastException if the specified element cannot be compared with elements currently in the priority queue according to the priority queue's ordering.
InvalidOperationException If the element cannot be added at this time due to capacity restrictions.
ArgumentNullException If the supplied objectToAdd is and this queue does not permit elements.
ArgumentException If some property of the supplied objectToAdd prevents it from being added to this queue.

See Also

PriorityQueue Class | Spring.Collections Namespace