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 : IDisposableConstructors
View SourceTimedScope(Int64)
Initializes a new instance of the TimedScope class.
Declaration
public TimedScope(long millisecondsDuration)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int64 | millisecondsDuration | The number of milliseconds the scope should at least take. | 
TimedScope(Int64, CancellationToken)
Initializes a new instance of the TimedScope class.
Declaration
public TimedScope(long millisecondsDuration, CancellationToken cancellationToken)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int64 | millisecondsDuration | The number of milliseconds the scope should at least take. | 
| CancellationToken | cancellationToken | The cancellation token. | 
TimedScope(Int64, TimeProvider)
Initializes a new instance of the TimedScope class.
Declaration
public TimedScope(long millisecondsDuration, TimeProvider timeProvider)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int64 | millisecondsDuration | The number of milliseconds the scope should at least take. | 
| TimeProvider | timeProvider | The time provider. | 
TimedScope(Int64, TimeProvider, CancellationToken)
Initializes a new instance of the TimedScope class.
Declaration
public TimedScope(long millisecondsDuration, TimeProvider timeProvider, CancellationToken cancellationToken)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int64 | millisecondsDuration | The number of milliseconds the scope should at least take. | 
| TimeProvider | timeProvider | The time provider. | 
| CancellationToken | cancellationToken | The cancellation token. | 
TimedScope(TimeSpan)
Initializes a new instance of the TimedScope class.
Declaration
public TimedScope(TimeSpan duration)Parameters
| Type | Name | Description | 
|---|---|---|
| TimeSpan | duration | The duration the scope should at least take. | 
TimedScope(TimeSpan, CancellationToken)
Initializes a new instance of the TimedScope class.
Declaration
public TimedScope(TimeSpan duration, CancellationToken cancellationToken)Parameters
| Type | Name | Description | 
|---|---|---|
| TimeSpan | duration | The duration the scope should at least take. | 
| CancellationToken | cancellationToken | The cancellation token. | 
TimedScope(TimeSpan, TimeProvider)
Initializes a new instance of the TimedScope class.
Declaration
public TimedScope(TimeSpan duration, TimeProvider timeProvider)Parameters
| Type | Name | Description | 
|---|---|---|
| TimeSpan | duration | The duration the scope should at least take. | 
| TimeProvider | timeProvider | The time provider. | 
TimedScope(TimeSpan, TimeProvider, CancellationToken)
Initializes a new instance of the TimedScope class.
Declaration
public TimedScope(TimeSpan duration, TimeProvider timeProvider, CancellationToken cancellationToken)Parameters
| Type | Name | Description | 
|---|---|---|
| TimeSpan | duration | The duration the scope should at least take. | 
| TimeProvider | timeProvider | The time provider. | 
| CancellationToken | cancellationToken | The cancellation token. | 
Properties
View SourceElapsed
Gets the elapsed time.
Declaration
public TimeSpan Elapsed { get; }Property Value
| Type | Description | 
|---|---|
| TimeSpan | The elapsed time. | 
Remaining
Gets the remaining time.
Declaration
public TimeSpan Remaining { get; }Property Value
| Type | Description | 
|---|---|
| TimeSpan | 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 | 
|---|---|
| ValueTask | A task that represents the asynchronous dispose operation. | 
Remarks
This will delay using