Class AsyncEventArgs
Provides data for AsyncEventHandler<TEvent> events that can be invoked asynchronously.
public class AsyncEventArgs
- Inheritance
-
AsyncEventArgs
- Derived
- Inherited Members
Constructors
AsyncEventArgs(CancellationToken)
Initializes a new instance of the AsyncEventArgs class.
public AsyncEventArgs(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA cancellation token related to the original operation that raised the event. It's important for your handler to pass this token along to any asynchronous or long-running synchronous operations that take a token so cancellation will correctly propagate. The default value is None.
Fields
Empty
Provides a value to use with events that do not have event data.
public static readonly AsyncEventArgs Empty
Field Value
Properties
CancellationToken
Gets a cancellation token related to the original operation that raised the event. It's important for your handler to pass this token along to any asynchronous or long-running synchronous operations that take a token so cancellation (via something like
new CancellationTokenSource(TimeSpan.FromSeconds(10)).Token
for example) will correctly propagate.
public CancellationToken CancellationToken { get; }
Property Value
Methods
CreateOrDefault(CancellationToken)
public static AsyncEventArgs CreateOrDefault(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationToken