Class TimedScope
Makes a code block timed (take at least a certain amount of time). This class cannot be inherited.
Inheritance
Namespace: Umbraco.Cms.Core
Assembly: Umbraco.Core.dll
Syntax
public sealed class TimedScope : IDisposable
Constructors
View SourceTimedScope(Int64)
Initializes a new instance of the Timed
Declaration
public TimedScope(long millisecondsDuration)
Parameters
Type | Name | Description |
---|---|---|
System. |
millisecondsDuration | The number of milliseconds the scope should at least take. |
TimedScope(Int64, CancellationToken)
Initializes a new instance of the Timed
Declaration
public TimedScope(long millisecondsDuration, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System. |
millisecondsDuration | The number of milliseconds the scope should at least take. |
Cancellation |
cancellationToken | The cancellation token. |
TimedScope(Int64, TimeProvider)
Initializes a new instance of the Timed
Declaration
public TimedScope(long millisecondsDuration, TimeProvider timeProvider)
Parameters
Type | Name | Description |
---|---|---|
System. |
millisecondsDuration | The number of milliseconds the scope should at least take. |
Time |
timeProvider | The time provider. |
TimedScope(Int64, TimeProvider, CancellationToken)
Initializes a new instance of the Timed
Declaration
public TimedScope(long millisecondsDuration, TimeProvider timeProvider, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System. |
millisecondsDuration | The number of milliseconds the scope should at least take. |
Time |
timeProvider | The time provider. |
Cancellation |
cancellationToken | The cancellation token. |
TimedScope(TimeSpan)
Initializes a new instance of the Timed
Declaration
public TimedScope(TimeSpan duration)
Parameters
Type | Name | Description |
---|---|---|
Time |
duration | The duration the scope should at least take. |
TimedScope(TimeSpan, CancellationToken)
Initializes a new instance of the Timed
Declaration
public TimedScope(TimeSpan duration, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Time |
duration | The duration the scope should at least take. |
Cancellation |
cancellationToken | The cancellation token. |
TimedScope(TimeSpan, TimeProvider)
Initializes a new instance of the Timed
Declaration
public TimedScope(TimeSpan duration, TimeProvider timeProvider)
Parameters
Type | Name | Description |
---|---|---|
Time |
duration | The duration the scope should at least take. |
Time |
timeProvider | The time provider. |
TimedScope(TimeSpan, TimeProvider, CancellationToken)
Initializes a new instance of the Timed
Declaration
public TimedScope(TimeSpan duration, TimeProvider timeProvider, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Time |
duration | The duration the scope should at least take. |
Time |
timeProvider | The time provider. |
Cancellation |
cancellationToken | The cancellation token. |
Properties
View SourceElapsed
Gets the elapsed time.
Declaration
public TimeSpan Elapsed { get; }
Property Value
Type | Description |
---|---|
Time |
The elapsed time. |
Remaining
Gets the remaining time.
Declaration
public TimeSpan Remaining { get; }
Property Value
Type | Description |
---|---|
Time |
The remaining time. |
Methods
View SourceCancel()
Cancels the timed scope.
Declaration
public void Cancel()
CancelAsync()
Cancels the timed scope asynchronously.
Declaration
public async Task CancelAsync()
Returns
Type | Description |
---|---|
Task |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Remarks
This will block using
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
Declaration
public async ValueTask DisposeAsync()
Returns
Type | Description |
---|---|
Value |
A task that represents the asynchronous dispose operation. |
Remarks
This will delay using