Scheduler.AsStopwatchProvider(IScheduler) method¶
Defined in
Type: Scheduler
Namespace: System.Reactive.Concurrency
Assembly: System.Reactive.dll
Applies to
netstandard2.0
public static IStopwatchProvider? AsStopwatchProvider(this IScheduler scheduler)
Summary:
Returns the IStopwatchProvider implementation of the specified scheduler, or null if no such implementation is available.
Parameters
| Name | Type | Description |
|---|---|---|
scheduler | [IScheduler](# | Scheduler to get the [IStopwatchProvider](# implementation for. |
Returns: IStopwatchProvider? -- The scheduler's IStopwatchProvider implementation if available; null otherwise.
Remarks
This helper method is made available for query operator authors in order to discover scheduler services by using the required IServiceProvider pattern, which allows for interception or redefinition of scheduler services.
Consider using StartStopwatch in case a stopwatch is required, but use of emulation stopwatch based on the scheduler's clock is acceptable. Use of this method is recommended for best-effort use of the stopwatch provider scheduler service, where the caller falls back to not using stopwatches if this facility wasn't found.