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

C# 9.0 support #222

Merged
merged 1 commit into from
Jun 15, 2021
Merged

C# 9.0 support #222

merged 1 commit into from
Jun 15, 2021

Conversation

zorgesho
Copy link
Member

Changes made in this pull request

  • LangVersion is changed to 9.0
  • IsExternalInit class is added to fix compiler errors when using records and init property modifier

Copy link
Contributor

@toebeann toebeann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you'd rather not use a package for the IsExternalInit polyfill, it should live in its own class file somewhere rather than being hidden in an unrelated class definition file.

However, this NuGet package takes care of that for you. If you use the new (since VS2017) PackageReference syntax in the .csproj to add the NuGet package, the file doesn't get added directly to your project (which also means it doesn't get accidentally deleted/modified by someone), it only gets compiled into the code if the target runtime doesn't include IsExternalInit already.

The only change required is to add the following to the .csproj (assuming you have NuGet set up to use PackageReference format):

<ItemGroup>
  <PackageReference Include="IsExternalInit" Version="1.0.0" PrivateAssets="all" />
</ItemGroup>

But if you'd really rather not use a package for this, I'd be much happier if the polyfill was moved into its own file.

SMLHelper/Initializer.cs Outdated Show resolved Hide resolved
@zorgesho zorgesho merged commit 49dceda into dev Jun 15, 2021
@zorgesho zorgesho deleted the c#-9.0 branch June 15, 2021 00:32
@MrPurple6411 MrPurple6411 mentioned this pull request Jun 21, 2021
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.

3 participants