Skip to content

Latest commit

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date

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:

<PackageReferenceInclude="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:

publicrecordMyRecord(stringMyString);

Then build your project.

About

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

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages