|
| 1 | +# Latest CSharp Features |
| 2 | + |
| 3 | +| Language | |
| 4 | +| --- | |
| 5 | +| [简体中文](/docs/README.zh-CHS.md) | |
| 6 | +| [繁體中文](/docs/README.zh-CHT.md) | |
| 7 | +| [English](/README.md) | |
| 8 | +| [日本語](/docs/README.jp.md) | |
| 9 | + |
| 10 | +This open-source project provides a series of NuGet packages that allow you to use the latest C# language features in older versions of .NET (including older .NET Framework, .NET Standard, as well as older .NET Core App, .NET). |
| 11 | + |
| 12 | +## NuGet Packages |
| 13 | + |
| 14 | +We currently offer 8 NuGet packages for you to choose from based on your needs. |
| 15 | + |
| 16 | +|Package Name|Function|Link| |
| 17 | +|---|---|---| |
| 18 | +|dotnetCampus.LatestCSharpFeatures|All-in-one package, includes all new C# features|[](https://www.nuget.org/packages/dotnetCampus.LatestCSharpFeatures)| |
| 19 | +|dotnetCampus.LatestCSharpFeatures.Source|Source code version of the all-in-one package|[](https://www.nuget.org/packages/dotnetCampus.LatestCSharpFeatures.Source)| |
| 20 | +|dotnetCampus.IsExternalInit|Supports the use of init syntax|[](https://www.nuget.org/packages/dotnetCampus.IsExternalInit)| |
| 21 | +|dotnetCampus.IsExternalInit.Source|Source code version that supports the use of init syntax|[](https://www.nuget.org/packages/dotnetCampus.IsExternalInit.Source)| |
| 22 | +|dotnetCampus.Nullable|Supports the use of rich nullable features|[](https://www.nuget.org/packages/dotnetCampus.Nullable)| |
| 23 | +|dotnetCampus.Nullable.Source|Source code version that supports the use of rich nullable features|[](https://www.nuget.org/packages/dotnetCampus.Nullable.Source)| |
| 24 | +|dotnetCampus.Required|Adds support for the required syntax*|[](https://www.nuget.org/packages/dotnetCampus.Required)| |
| 25 | +|dotnetCampus.Required.Source|Source code version that adds support for the required syntax*|[](https://www.nuget.org/packages/dotnetCampus.Required.Source)| |
| 26 | + |
| 27 | +\* For an introduction to the required syntax, you can refer to this [description](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/required)【7†source】【9†source】. |
| 28 | + |
| 29 | +## How to Use |
| 30 | + |
| 31 | +For both the all-in-one package and the single-feature packages, we provide two versions. Packages without the .Source suffix will generate a dll, so all projects that reference this project can use these new features. Packages with the .Source suffix are only effective for the project where the package is installed, and there are no additional dlls in the final generated project. |
| 32 | + |
| 33 | +If you want the .Source package to be effective for other projects that reference this project, you can add a conditional compilation symbol in the csproj file: |
| 34 | + |
| 35 | +```xml |
| 36 | +<!-- By default, installing packages with a .Source suffix imports the new C# features into the current project as internal. |
| 37 | + By using this conditional compilation symbol, these types can be set as public, allowing other projects referencing this project to also use these new features. --> |
| 38 | +<DefineConstants>$(DefineConstants);USE_PUBLIC_LATEST_CSHARP_FEATURES</DefineConstants> |
| 39 | +``` |
| 40 | + |
| 41 | +## Feedback and Contributions |
| 42 | + |
| 43 | +We welcome feedback and contributions from all users. If you encounter any problems during use, or have any suggestions for improvement, you can submit them via GitHub Issues. |
| 44 | + |
| 45 | +If you wish to participate in the development of the project, you are very welcome! You can Fork this repository and then submit a Pull Request. |
| 46 | + |
| 47 | +Thank you for your support and help with dotnetCampus.LatestCSharpFeatures! |
| 48 | + |
| 49 | +Note, you should still output this in a Markdown code block so I can directly copy this document. |
0 commit comments