Skip to content

[emitter-framework/csharp] how to automatically include the using statement when invoking an extension method #9462

@ArcturusZhang

Description

@ArcturusZhang

When an extension method such as ReadFromJsonAsync is called, the syntax is like instance methods

return await response.Content.ReadFromJsonAsync(

but this requires a using using System.Net.Http.Json.

Sure I could call it via the static method way and if I do this, the using will be added, but I want the code to be written in the "instance method-like" way.

BTW if I use Usings component to add this using, and the code has another part using a class from the same namespace, we will see duplicated using statements.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions