You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for the following meta for class access modifiers: @:file for file @:internal for internal @:public for public
Suggested Syntax
The syntax could be as follows:
@:publicclassMyClass { }
To generate C# as follows:
publicclassMyClass{}
Details
Currently, classes are generated with no access modifiers. C# has the default modifier of internal when not specified, so all generated classes effectively have that modifier. This makes it impossible to develop a library package since all generated classes would be inaccessible when references by other projects.
Suggested Code Change
I can submit a pull request to show a rough idea of what this would look like.
Other Notes
There are also other class access modifiers (and accessibility levels) that would be applicable to nested classes, but I am not sure about the feasibility of generating nested classes, so those are excluded from this request.
Request
Add support for the following meta for class access modifiers:
@:file
forfile
@:internal
forinternal
@:public
forpublic
Suggested Syntax
The syntax could be as follows:
To generate C# as follows:
Details
Currently, classes are generated with no access modifiers. C# has the default modifier of
internal
when not specified, so all generated classes effectively have that modifier. This makes it impossible to develop a library package since all generated classes would be inaccessible when references by other projects.Suggested Code Change
I can submit a pull request to show a rough idea of what this would look like.
Other Notes
There are also other class access modifiers (and accessibility levels) that would be applicable to nested classes, but I am not sure about the feasibility of generating nested classes, so those are excluded from this request.
References
Microsoft-documented C# access modifiers and accessibility levels:
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/access-modifiers
The text was updated successfully, but these errors were encountered: