Skip to content

Crono1981/IsExternalInit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Easily Add record support to a .NET Standard library

How to add C# record support or init support in a .NET Standard 2.0 library.

Just change your project to use the latest C# language version and add this nuget package.

Use latest C# version:

In .NET Standard 2.0, change your .csproj to use the latest lang version by adding the LangVersion element:

<PropertyGroup>
  <TargetFramework>netstandard2.0</TargetFramework>
  <LangVersion>latest</LangVersion>
</PropertyGroup>

Install the nuget package:

As a Project Reference:

<PackageReference Include="dotnetKyle.IsExternalInit" version="1.0.0" />

Using the CLI:

dotnet add package dotnetKyle.IsExternalInit

Using the Package Manager Console:

Install-Package dotnetKyle.IsExternalInit

Testing:

To test, rebuild your project to get your record or init setter to start working.

Alternatively, you can create a test record:

public record MyRecord(string MyString);

Then build your project.

About

The is external init class (for fixing .Net Standard 2.0 to work with the newest C# version).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Pascal 100.0%