Created
May 19, 2021 10:48
-
-
Save guitarrapc/a963b7aadbbf7c244f794c8cb4ce8856 to your computer and use it in GitHub Desktop.
Extension Method will not call.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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