Skip to content

Support C#11 file-local types #53

@pmg23

Description

@pmg23

C#11 introduced file-local types, e.g.:

file Widget { }

For such a type TypeNameFormatter's GetFormattedName with default options returns a string like:

<Widget>F17747E0EBC6415B90778A501AEC22976F1C544F0DC79EFDAF3C948D89987F740__Widget

I suggest that with default options the result should be simply Widget, corresponding to the name in C# code.

Perhaps there should be a new option to opt out of that, analagous to NoAnonymousTypes.

Note that my proposal opens the possiblility of collisions where (distinct) file-local types of the same name and namespace in different files would map to the same formatted name, even in Namespaces mode. I think that is fine - there is precedent for allowing collisions, for example in the case of anonymous types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions