Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the csharp even smaller with the C# 9 changes #112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ctyar
Copy link

@ctyar ctyar commented Oct 20, 2020

With top-level programs in C# 9, we can reduce the size significantly.
The result is still same as:

class A
{
    static void Main()
    {
    }
}

@dscorbett
Copy link
Contributor

I think it would be nice to keep the old file as csharp-8.cs, like how there are many files for old versions of HTML.

@ctyar
Copy link
Author

ctyar commented Nov 23, 2020

@dscorbett done.
Also, there is a new line at the end of the old file, should I remove that too?

@dscorbett
Copy link
Contributor

Yes, assuming that a final newline wasn’t necessary in C# 8.

@ToastyMallows
Copy link

If we're just focusing on the .cs file itself and not the associated .csproj file, using top-level statements, here's the smallest file that I could come up with:

int a;

This file builds and runs, outputs nothing, and is 6 bytes in size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants