DotNetCampus.LatestCSharpFeatures
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.
Install / Use
/learn @dotnet-campus/DotNetCampus.LatestCSharpFeaturesREADME
Latest CSharp Features
| English | 简体中文 | 繁體中文 | | ------------- | ------------------- | ------------------- |
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
Simply install the DotNetCampus.LatestCSharpFeatures NuGet package.
<!-- 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="13.0.0" PrivateAssets="all" />
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:
<!-- By default, DotNetCampus.LatestCSharpFeatures introduces most 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.
Note: Index/Range types are always internal and not affected by this setting. See explanation below. -->
<DefineConstants>$(DefineConstants);USE_PUBLIC_LATEST_CSHARP_FEATURES</DefineConstants>
If your project already references other libraries that provide implementations of Index/Range, type conflicts may occur. In such cases, you can disable our Index/Range implementation:
<!-- If your project already has other Index/Range implementations (e.g., through the official System.Runtime.CompilerServices.IndexRange or other third-party libraries),
use this conditional compilation symbol to disable our Index/Range implementation to avoid type conflicts. -->
<DefineConstants>$(DefineConstants);DISABLE_LATEST_CSHARP_FEATURES_INDEX_RANGE</DefineConstants>
Special Note: Unlike other features, Index/Range types always maintain an internal access level and will not become public due to the
USE_PUBLIC_LATEST_CSHARP_FEATURESsetting. This is because Index/Range are used in public APIs, and if set to public, they may cause compatibility issues with other libraries that use the official Index/Range implementation. Other features are typically for internal use and do not cause such compatibility issues.
Feedback and Contributions
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 also very welcome! You can Fork this repository and then submit a Pull Request.
Thank you for your support and help with DotNetCampus.LatestCSharpFeatures!
Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
Languages
Security Score
Audited on Oct 7, 2025
