Class AsyncTimeMeasureOptions
- Namespace
- Cuemon.Diagnostics
- Assembly
- Cuemon.Diagnostics.dll
Specifies options that is related to TimeMeasure operations. This class cannot be inherited.
public sealed class AsyncTimeMeasureOptions : TimeMeasureOptions, IParameterObject, IAsyncOptions
- Inheritance
-
AsyncTimeMeasureOptions
- Implements
- Inherited Members
Examples
The following example demonstrates how to configure
using System;
using System.Threading;
using Cuemon.Diagnostics;
using Cuemon.Reflection;
namespace MyApp.Examples;
public static class AsyncTimeMeasureOptionsExample
{
public static void Demonstrate()
{
var options = new AsyncTimeMeasureOptions
{
TimeMeasureCompletedThreshold = TimeSpan.FromMilliseconds(100),
CancellationToken = CancellationToken.None,
MethodDescriptor = () => MethodDescriptor.Create(typeof(AsyncTimeMeasureOptionsExample).GetMethod(nameof(Demonstrate))!),
RuntimeParameters = new object[] { "warmup" }
};
Console.WriteLine(options.TimeMeasureCompletedThreshold);
Console.WriteLine(options.CancellationToken.CanBeCanceled);
Console.WriteLine(options.MethodDescriptor().MethodName);
Console.WriteLine(options.RuntimeParameters.Length);
}
}
Constructors
AsyncTimeMeasureOptions()
Initializes a new instance of the TimeMeasureOptions class.
public AsyncTimeMeasureOptions()
Remarks
The following table shows the initial property values for an instance of TimeMeasureOptions.
| Property | Initial Value |
|---|---|
| CancellationToken | default |
Properties
CancellationToken
Gets or sets the cancellation token of an asynchronous operations.
public CancellationToken CancellationToken { get; set; }
Property Value
- CancellationToken
The cancellation token of an asynchronous operations.