-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from dotnet-campus/t/walterlv/refactor
弃用多个包,仅使用单一全功能包(避免开发者难维护,用户难选)
- Loading branch information
Showing
33 changed files
with
359 additions
and
692 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,37 @@ | ||
# Latest CSharp Features | ||
|
||
| Language | | ||
| --- | | ||
| Language | | ||
| ---------------------------------- | | ||
| [简体中文](/docs/README.zh-CHS.md) | | ||
| [繁體中文](/docs/README.zh-CHT.md) | | ||
| [English](/README.md) | | ||
| [日本語](/docs/README.jp.md) | | ||
| [English](/README.md) | | ||
|
||
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). | ||
[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.LatestCSharpFeatures.svg)](https://www.nuget.org/packages/dotnetCampus.LatestCSharpFeatures) | ||
|
||
## NuGet Packages | ||
|
||
We currently offer 8 NuGet packages for you to choose from based on your needs. | ||
|
||
|Package Name|Function|Link| | ||
|---|---|---| | ||
|dotnetCampus.LatestCSharpFeatures|All-in-one package, includes all new C# features|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.LatestCSharpFeatures.svg)](https://www.nuget.org/packages/dotnetCampus.LatestCSharpFeatures)| | ||
|dotnetCampus.LatestCSharpFeatures.Source|Source code version of the all-in-one package|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.LatestCSharpFeatures.Source.svg)](https://www.nuget.org/packages/dotnetCampus.LatestCSharpFeatures.Source)| | ||
|dotnetCampus.IsExternalInit|Supports the use of init syntax|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.IsExternalInit.svg)](https://www.nuget.org/packages/dotnetCampus.IsExternalInit)| | ||
|dotnetCampus.IsExternalInit.Source|Source code version that supports the use of init syntax|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.IsExternalInit.Source.svg)](https://www.nuget.org/packages/dotnetCampus.IsExternalInit.Source)| | ||
|dotnetCampus.Nullable|Supports the use of rich nullable features|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.Nullable.svg)](https://www.nuget.org/packages/dotnetCampus.Nullable)| | ||
|dotnetCampus.Nullable.Source|Source code version that supports the use of rich nullable features|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.Nullable.Source.svg)](https://www.nuget.org/packages/dotnetCampus.Nullable.Source)| | ||
|dotnetCampus.Required|Adds support for the required syntax*|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.Required.svg)](https://www.nuget.org/packages/dotnetCampus.Required)| | ||
|dotnetCampus.Required.Source|Source code version that adds support for the required syntax*|[![NuGet](https://img.shields.io/nuget/v/dotnetCampus.Required.Source.svg)](https://www.nuget.org/packages/dotnetCampus.Required.Source)| | ||
|
||
\* 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】. | ||
This open-source project provides a NuGet package, dotnetCampus.LatestCSharpFeatures, which allows you to use the latest C# language features in older versions of .NET, including the old .NET Framework, .NET Standard, and older versions of .NET Core App and .NET. | ||
|
||
## How to Use | ||
|
||
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. | ||
Simply install the dotnetCampus.LatestCSharpFeatures NuGet package. | ||
|
||
```xml | ||
<!-- Since dotnetCampus.LatestCSharpFeatures only contains source generators, it does not introduce any runtime dependencies. | ||
We can set it to PrivateAssets="all" to avoid passing it on to other projects. --> | ||
<PackageReference Include="dotnetCampus.LatestCSharpFeatures" Version="12.0.0" PrivateAssets="all" /> | ||
``` | ||
|
||
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: | ||
If you want these new language features to also be effective for other projects that reference this project, you can add a conditional compilation symbol in the csproj file: | ||
|
||
```xml | ||
<!-- By default, installing packages with a .Source suffix imports the new C# features into the current project as internal. | ||
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. --> | ||
<!-- By default, dotnetCampus.LatestCSharpFeatures introduces new C# features into the current project using the internal modifier. | ||
By using this conditional compilation symbol, these types can be set to public, allowing other projects referencing this project to also use these new features. --> | ||
<DefineConstants>$(DefineConstants);USE_PUBLIC_LATEST_CSHARP_FEATURES</DefineConstants> | ||
``` | ||
|
||
## Feedback and Contributions | ||
|
||
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. | ||
We welcome feedback and contributions from all users. If you encounter any problems during use, or have any suggestions for improvements, you can submit them via GitHub Issues. | ||
|
||
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. | ||
If you wish to participate in the development of the project, you are also very welcome! You can Fork this repository and then submit a Pull Request. | ||
|
||
Thank you for your support and help with dotnetCampus.LatestCSharpFeatures! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<Version>11.0.0</Version> | ||
<!-- 此版本号仅作标记使用,标记当前支持的最新 C# 版本 --> | ||
<Version>12.0.0</Version> | ||
</PropertyGroup> | ||
</Project> | ||
</Project> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.