© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
12 replies
SWEETPONY

why do we need IAsyncDisposable here?

I found this and I don't understand why author use IAsyncDisposable instead of IDisposable. Can someone help me to understand?
/// <summary>
///     The context in which the WebAuthn operation is being processed.
/// </summary>
public interface IWebAuthnContext : IAsyncDisposable
{
    /// <summary>
    ///     The context of the HTTP request in which the WebAuthn operation is being processed.
    /// </summary>
    public HttpContext HttpContext { get; }

    /// <summary>
    ///     Save the changes made in this context.
    /// </summary>
    /// <param name="cancellationToken">Cancellation token for an asynchronous operation.</param>
    Task CommitAsync(CancellationToken cancellationToken);
}
/// <summary>
///     The context in which the WebAuthn operation is being processed.
/// </summary>
public interface IWebAuthnContext : IAsyncDisposable
{
    /// <summary>
    ///     The context of the HTTP request in which the WebAuthn operation is being processed.
    /// </summary>
    public HttpContext HttpContext { get; }

    /// <summary>
    ///     Save the changes made in this context.
    /// </summary>
    /// <param name="cancellationToken">Cancellation token for an asynchronous operation.</param>
    Task CommitAsync(CancellationToken cancellationToken);
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Why do i need to pass in the generics here?
C#CC# / help
2y ago
❔ Why do we need to provide values for base class we are inheriting from?
C#CC# / help
3y ago
idk what I need to do here
C#CC# / help
3y ago
❔ Do I need Marshal.AddRef/Release here?
C#CC# / help
3y ago