csharplang icon indicating copy to clipboard operation
csharplang copied to clipboard

[Proposal]: Ignored Directives Support (VS 18.0, .NET 10)

Open 333fred opened this issue 1 year ago • 0 comments

Ignored Directives Support

  • Specification: https://github.com/dotnet/csharplang/blob/main/proposals/csharp-14.0/ignored-directives.md
  • Discussion: https://github.com/dotnet/csharplang/discussions/8616

Summary

As we move to allow C# statements in the top level of a file, it's reasonable to assume that we might someday get support for dotnet runing a .cs file. For further use of C# as a scripting language in this vein, I propose that we introduce a new preprocessor directive who's purpose is to exist solely to be ignored by the language: the hashbang directive. Linux and Unix scripts will often use #! in order to direct the program loader to the interpreter that can run them. We should add a similar ignore to the C# language.

Design meetings

  • https://github.com/dotnet/csharplang/blob/main/meetings/2021/LDM-2021-05-12.md#simple-c-programs
  • https://github.com/dotnet/csharplang/blob/main/meetings/2022/LDM-2022-08-31.md#ignored-directives-support
  • https://github.com/dotnet/csharplang/blob/main/meetings/2022/LDM-2022-09-26.md#ungrouped
  • https://github.com/dotnet/csharplang/blob/main/meetings/2025/LDM-2025-03-12.md#ignored-directives

333fred avatar Nov 19 '24 00:11 333fred