Class ScheduledItem<TAbsolute>
Abstract base class for scheduled work items.
Inherited Members
Namespace: System.Reactive.Concurrency
Assembly: System.Reactive.Core.dll
Syntax
public abstract class ScheduledItem<TAbsolute> : IScheduledItem<TAbsolute>, IComparable<ScheduledItem<TAbsolute>> where TAbsolute : IComparable<TAbsolute>
Type Parameters
Name | Description |
---|---|
TAbsolute | Absolute time representation type. |
Constructors
| Improve this Doc View SourceScheduledItem(TAbsolute, IComparer<TAbsolute>)
Creates a new scheduled work item to run at the specified time.
Declaration
protected ScheduledItem(TAbsolute dueTime, IComparer<TAbsolute> comparer)
Parameters
Type | Name | Description |
---|---|---|
TAbsolute | dueTime | Absolute time at which the work item has to be executed. |
IComparer<TAbsolute> | comparer | Comparer used to compare work items based on their scheduled time. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Properties
| Improve this Doc View SourceDueTime
Gets the absolute time at which the item is due for invocation.
Declaration
public TAbsolute DueTime { get; }
Property Value
Type | Description |
---|---|
TAbsolute |
IsCanceled
Gets whether the work item has received a cancellation request.
Declaration
public bool IsCanceled { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceCancel()
Cancels the work item by disposing the resource returned by InvokeCore as soon as possible.
Declaration
public void Cancel()
CompareTo(ScheduledItem<TAbsolute>)
Compares the work item with another work item based on absolute time values.
Declaration
public int CompareTo(ScheduledItem<TAbsolute> other)
Parameters
Type | Name | Description |
---|---|---|
ScheduledItem<TAbsolute> | other | Work item to compare the current work item to. |
Returns
Type | Description |
---|---|
Int32 | Relative ordering between this and the specified work item. |
Remarks
The inequality operators are overloaded to provide results consistent with the IComparable implementation. Equality operators implement traditional reference equality semantics.
Equals(Object)
Determines whether a ScheduledItem<TAbsolute> object is equal to the specified object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The object to compare to the current ScheduledItem<TAbsolute> object. |
Returns
Type | Description |
---|---|
Boolean | true if the obj parameter is a ScheduledItem<TAbsolute> object and is equal to the current ScheduledItem<TAbsolute> object; otherwise, false. |
Overrides
| Improve this Doc View SourceGetHashCode()
Returns the hash code for the current ScheduledItem<TAbsolute> object.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A 32-bit signed integer hash code. |
Overrides
| Improve this Doc View SourceInvoke()
Invokes the work item.
Declaration
public void Invoke()
InvokeCore()
Implement this method to perform the work item invocation, returning a disposable object for deep cancellation.
Declaration
protected abstract IDisposable InvokeCore()
Returns
Type | Description |
---|---|
IDisposable | Disposable object used to cancel the work item and/or derived work items. |
Operators
| Improve this Doc View SourceEquality(ScheduledItem<TAbsolute>, ScheduledItem<TAbsolute>)
Determines whether two specified ScheduledItem<TAbsolute, TValue> objects are equal.
Declaration
public static bool operator ==(ScheduledItem<TAbsolute> left, ScheduledItem<TAbsolute> right)
Parameters
Type | Name | Description |
---|---|---|
ScheduledItem<TAbsolute> | left | The first object to compare. |
ScheduledItem<TAbsolute> | right | The second object to compare. |
Returns
Type | Description |
---|---|
Boolean | true if both ScheduledItem<TAbsolute, TValue> are equal; otherwise, false. |
Remarks
This operator does not provide results consistent with the IComparable implementation. Instead, it implements reference equality.
GreaterThan(ScheduledItem<TAbsolute>, ScheduledItem<TAbsolute>)
Determines whether one specified ScheduledItem<TAbsolute> object is due after a second specified ScheduledItem<TAbsolute> object.
Declaration
public static bool operator>(ScheduledItem<TAbsolute> left, ScheduledItem<TAbsolute> right)
Parameters
Type | Name | Description |
---|---|---|
ScheduledItem<TAbsolute> | left | The first object to compare. |
ScheduledItem<TAbsolute> | right | The second object to compare. |
Returns
Type | Description |
---|---|
Boolean | true if the DueTime value of left is later than the DueTime value of right; otherwise, false. |
Remarks
This operator provides results consistent with the IComparable implementation.
GreaterThanOrEqual(ScheduledItem<TAbsolute>, ScheduledItem<TAbsolute>)
Determines whether one specified ScheduledItem<TAbsolute> object is due after or at the same time of a second specified ScheduledItem<TAbsolute> object.
Declaration
public static bool operator >=(ScheduledItem<TAbsolute> left, ScheduledItem<TAbsolute> right)
Parameters
Type | Name | Description |
---|---|---|
ScheduledItem<TAbsolute> | left | The first object to compare. |
ScheduledItem<TAbsolute> | right | The second object to compare. |
Returns
Type | Description |
---|---|
Boolean | true if the DueTime value of left is later than or simultaneous with the DueTime value of right; otherwise, false. |
Remarks
This operator provides results consistent with the IComparable implementation.
Inequality(ScheduledItem<TAbsolute>, ScheduledItem<TAbsolute>)
Determines whether two specified ScheduledItem<TAbsolute, TValue> objects are inequal.
Declaration
public static bool operator !=(ScheduledItem<TAbsolute> left, ScheduledItem<TAbsolute> right)
Parameters
Type | Name | Description |
---|---|---|
ScheduledItem<TAbsolute> | left | The first object to compare. |
ScheduledItem<TAbsolute> | right | The second object to compare. |
Returns
Type | Description |
---|---|
Boolean | true if both ScheduledItem<TAbsolute, TValue> are inequal; otherwise, false. |
Remarks
This operator does not provide results consistent with the IComparable implementation. Instead, it implements reference equality.
LessThan(ScheduledItem<TAbsolute>, ScheduledItem<TAbsolute>)
Determines whether one specified ScheduledItem<TAbsolute> object is due before a second specified ScheduledItem<TAbsolute> object.
Declaration
public static bool operator <(ScheduledItem<TAbsolute> left, ScheduledItem<TAbsolute> right)
Parameters
Type | Name | Description |
---|---|---|
ScheduledItem<TAbsolute> | left | The first object to compare. |
ScheduledItem<TAbsolute> | right | The second object to compare. |
Returns
Type | Description |
---|---|
Boolean | true if the DueTime value of left is earlier than the DueTime value of right; otherwise, false. |
Remarks
This operator provides results consistent with the IComparable implementation.
LessThanOrEqual(ScheduledItem<TAbsolute>, ScheduledItem<TAbsolute>)
Determines whether one specified ScheduledItem<TAbsolute> object is due before or at the same of a second specified ScheduledItem<TAbsolute> object.
Declaration
public static bool operator <=(ScheduledItem<TAbsolute> left, ScheduledItem<TAbsolute> right)
Parameters
Type | Name | Description |
---|---|---|
ScheduledItem<TAbsolute> | left | The first object to compare. |
ScheduledItem<TAbsolute> | right | The second object to compare. |
Returns
Type | Description |
---|---|
Boolean | true if the DueTime value of left is earlier than or simultaneous with the DueTime value of right; otherwise, false. |
Remarks
This operator provides results consistent with the IComparable implementation.