![image](https://user-images.githubusercontent.com/10199417/197341200-3810e13c-9104-4911-90fc-b8add0862458.png)
# What is it? ð
**PolySharp** provides generated, source-only polyfills for C# language features, to easily use all runtime-agnostic features downlevel. The package is distributed as a source generator, so that it will automatically detect which polyfills are needed depending on the target framework and project in use: just add a reference to **PolySharp**, set your C# language version to latest, and have fun!
# TLDR? What is this for? â¨
Put simply: are you working on .NET Framework, or UWP, or some other older .NET runtime and still would like to use all the cool new features that C# 11 has? Well this library lets you do just that! It will generate for you all the "magic types" that the C# compiler needs to "see" in order for it to allow using new language features even if you're not using the latest framework out there.
Here's an example of some of the new features that **PolySharp** can enable downlevel:
![image](https://user-images.githubusercontent.com/10199417/198630498-df1e215c-6788-4aef-8ba5-b0b71772233e.png)
> **Note**: not all the new C# features can be "tricked" this way (eg. those requiring runtime support, such as [static abstract members](https://learn.microsoft.com/dotnet/csharp/whats-new/tutorials/static-virtual-interface-members), still won't work). But almost everything else will (eg. nullability annotations, pattern matching, etc.), and this applies to a big number of new C# features. Try **PolySharp** out, don't get stuck on C# 6.0 or other older versions! ð
> **Note**: use on .NET Framework 3.5 is particularly limited due to shortcomings of the BCL there. In particular, the `System.Range` type will not be generated unless `System.ValueTuple` is referenced (meaning that eg. list patterns won't work by default), and some features such as records will not be usable at all due to the C# compiler missing some necessary APIs that cannot be polyfilled. All other features should work as expected.
# Documentation ð
**PolySharp** includes the following polyfills:
- Nullability attributes (for [nullable reference types](https://learn.microsoft.com/dotnet/csharp/nullable-references)):
- `[AllowNull]`
- `[DisallowNull]`
- `[DoesNotReturn]`
- `[DoesNotReturnIf]`
- `[MaybeNull]`
- `[MaybeNullWhen]`
- `[MemberNotNull]`
- `[MemberNotNullWhen]`
- `[NotNull]`
- `[NotNullIfNotNull]`
- `[NotNullWhen]`
- `Index` and `Range` (see [indices and ranges](https://learn.microsoft.com/dotnet/csharp/whats-new/tutorials/ranges-indexes))
- `[UnscopedRef]` (see [low-level struct improvements](https://github.com/dotnet/csharplang/blob/main/proposals/low-level-struct-improvements.md))
- Required members (see [required modifier](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/required))
- `[RequiredMember]`
- `[SetsRequiredMembers]`
- `[CompilerFeatureRequired]` (needed to support several features)
- `[IsExternalInit]` (needed for [init-only properties](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/init))
- `[SkipLocalsInit]` (see [docs](https://learn.microsoft.com/dotnet/csharp/language-reference/attributes/general#skiplocalsinit-attribute))
- Interpolated string handlers (see [docs](https://learn.microsoft.com/dotnet/csharp/whats-new/tutorials/interpolated-string-handler))
- `[InterpolatedStringHandler]`
- `[InterpolatedStringHandlerArgument]`
- `[CallerArgumentExpression]` (see [docs](https://learn.microsoft.com/dotnet/csharp/language-reference/proposals/csharp-10.0/caller-argument-expression))
- `[RequiresPreviewFeatures]` (needed for [preview features](https://github.com/dotnet/designs/blob/main/accepted/2021/preview-features/preview-features.md))
- `[AsyncMethodBuilder]` (needed for [custom method builder types](https://learn.microsoft.com/dotnet/csharp/language-reference/proposals/csharp-10.0/async-method-builders))
- `[StringSyntax]` (needed to enable [syntax highlight in the IDE](https://github.com/dotnet/runtime/issues/62505))
- `[ModuleInitializer]` (needed to enable [custom module initializers](https://learn.microsoft.com/dotnet/csharp/language-reference/proposals/csharp-9.0/module-initializers))
To leverage them, make sure to bump your C# language version. You can do this by setting the `<LangVersion>` MSBuild property in your project. For instance, by adding `<LangVersion>11.0</LangVersion>` (or your desired C# version) to the first `<PropertyGroup>` of your .csproj file. For more info on this, [see here](https://sergiopedri.medium.com/enabling-and-using-c-9-features-on-older-and-unsupported-runtimes-ce384d8debb), but remember that you don't need to manually copy polyfills anymore: simply adding a reference to **PolySharp** will do this for you automatically.
It also includes the following optional runtime-supported polyfills:
- Reflection annotation attributes (see [docs](https://learn.microsoft.com/dotnet/core/deploying/trimming/prepare-libraries-for-trimming)):
- `[DynamicallyAccessedMembers]`
- `[DynamicDependency]`
- `[RequiresUnreferencedCode]`
- `[RequiresDynamicCode]`
- `[UnconditionalSuppressMessage]`
- `[RequiresAssemblyFiles]`
- `[StackTraceHidden]` (see [here](https://makolyte.com/csharp-exclude-exception-throw-helper-methods-from-the-stack-trace/))
- `[UnmanagedCallersOnly]` (see [docs](https://learn.microsoft.com/dotnet/api/system.runtime.interopservices.unmanagedcallersonlyattribute)))
- Platform support annotation attributes (see [docs](https://learn.microsoft.com/dotnet/standard/analyzers/platform-compat-analyzer)):
- `[ObsoletedOSPlatform]`
- `[SupportedOSPlatform]`
- `[SupportedOSPlatformGuard]`
- `[TargetPlatform]`
- `[UnsupportedOSPlatform]`
- `[UnsupportedOSPlatformGuard]`
- `[SuppressGCTransition]` (see [here](https://devblogs.microsoft.com/dotnet/improvements-in-native-code-interop-in-net-5-0/))
- `[DisableRuntimeMarshalling]` (see [here](https://learn.microsoft.com/dotnet/standard/native-interop/disabled-marshalling))
# Options âï¸
**PolySharp**'s generation can be configured through some MSBuild properties to set in consuming projects.
The following properties are available:
- "PolySharpUsePublicAccessibilityForGeneratedTypes": makes all generated types public.
- "PolySharpIncludeRuntimeSupportedAttributes": enables polyfills for (dummy) runtime-supported attributes too.
- "PolySharpUseInteropServices2NamespaceForUnmanagedCallersOnlyAttribute": moves `[UnmanagedCallersOnly]`.
- "PolySharpExcludeGeneratedTypes": excludes specific types from generation (';' or ',' separated type names).
- "PolySharpIncludeGeneratedTypes": only includes specific types for generation (';' or ',' separated type names).
- "PolySharpExcludeTypeForwardedToDeclarations": never generates any `[TypeForwardedTo]` declarations.
没有合适的资源?快使用搜索试试~ 我知道了~
C# OpenVINO Nail Seg 指甲分割 指甲检测 源码
共272个文件
dll:81个
_:51个
xml:46个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 24 浏览量
2024-02-29
17:39:38
上传
评论
收藏 197.96MB RAR 举报
温馨提示
C# OpenVINO Nail Seg 指甲分割 指甲检测 源码 博客地址:https://lw112190.blog.csdn.net/article/details/136376932
资源推荐
资源详情
资源评论
收起资源包目录
C# OpenVINO Nail Seg 指甲分割 指甲检测 源码 (272个子文件)
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
_._ 0B
packages.config 1KB
app.config 161B
SegmentationResult.cs 7KB
Form1.cs 7KB
Form1.Designer.cs 5KB
Resources.Designer.cs 3KB
Common.cs 2KB
AssemblyInfo.cs 1KB
Result.cs 1KB
Settings.Designer.cs 1KB
ResultBase.cs 564B
Program.cs 438B
C# OpenVINO Nail Seg 指甲分割 指甲检测.csproj 10KB
OpenCvSharpExtern.dll 57.96MB
OpenCvSharpExtern.dll 39.72MB
openvino_intel_cpu_plugin.dll 32.47MB
opencv_videoio_ffmpeg480_64.dll 25.13MB
opencv_videoio_ffmpeg480.dll 22.3MB
openvino_intel_gpu_plugin.dll 17.38MB
openvino.dll 12.53MB
openvino_intel_gna_plugin.dll 4.29MB
openvino_onnx_frontend.dll 3.32MB
openvino_tensorflow_frontend.dll 3.26MB
gna.dll 3.03MB
openvino_pytorch_frontend.dll 1.78MB
openvino_paddle_frontend.dll 1.32MB
openvino_gapi_preproc.dll 1.08MB
openvino_tensorflow_lite_frontend.dll 1.03MB
OpenCvSharp.dll 922KB
OpenCvSharp.dll 919KB
OpenCvSharp.dll 919KB
OpenCvSharp.dll 919KB
System.Drawing.Common.dll 600KB
openvino_intel_npu_plugin.dll 532KB
npu_level_zero_backend.dll 513KB
System.Drawing.Common.dll 499KB
openvino_auto_plugin.dll 459KB
openvino_ir_frontend.dll 417KB
openvino_c.dll 381KB
openvino_hetero_plugin.dll 344KB
npu_driver_compiler_adapter.dll 300KB
openvino_auto_batch_plugin.dll 201KB
tbbbind_2_5.dll 195KB
tbb12.dll 183KB
System.Drawing.Common.dll 174KB
System.Drawing.Common.dll 171KB
System.Drawing.Common.dll 170KB
System.Numerics.Vectors.dll 160KB
System.Numerics.Vectors.dll 157KB
共 272 条
- 1
- 2
- 3
资源评论
天天代码码天天
- 粉丝: 6797
- 资源: 548
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功