Skip to content

Instantly share code, notes, and snippets.

@guitarrapc
Created May 19, 2021 10:48
Show Gist options
  • Save guitarrapc/a963b7aadbbf7c244f794c8cb4ce8856 to your computer and use it in GitHub Desktop.
Save guitarrapc/a963b7aadbbf7c244f794c8cb4ce8856 to your computer and use it in GitHub Desktop.
Extension Method will not call.
async Task Main()
{
await using var hoge = new Hoge();
}
public class Hoge : IAsyncDisposable
{
public ValueTask DisposeAsync()
{
Console.WriteLine("DisposeAsync in class");
return default;
}
}
public static class HogeExtensions
{
public static async ValueTask DisposeAsync(this Hoge hoge)
{
Console.WriteLine("DisposeAsync in extension method"); // never call
await hoge.DisposeAsync();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment