// <auto-generated/>
global using global::Namespace1;
global using global::Namespace2;
global using global::Namespace3;
主要集合:
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;
The compiler doesn't know anything about ImplicitUsings, it's an SDK feature. As @Guru Stron mentioned in a comment, you can add a syntax tree with the global usings to the compilation you're creating. The list of global usings can indeed vary.
The global usings tree should ideally be in the form:
// <auto-generated/>
global using global::Namespace1;
global using global::Namespace2;
global using global::Namespace3;
The main set are:
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;
发布评论
评论(1)
编译器对
隐式
一无所知,这是SDK功能。正如@Guru Stron在评论中提到的那样,您可以在您创建的汇编中添加带有全局使用的语法树。全球用途的清单确实可能会有所不同。全局使用树应该理想地以形式:
主要集合:
此列表来自 https://github.com/dotnet/sdk/blob/e797c37a264bf5b3a478baff0a085309228e0dea /src/tasks/microsoft.net.build.tasks/targets/microsoft.net.sdk.csharp.props#l25-l25-l34
参见
https://github.com/dotnet/sdk/blob/e797c37a264bf5b3a478baff0a085309228e0dea/src/src/websdk/websdk/websdk/web/web/sdk/sdk/sdk/sdk/sdk/sdk.props,propp,l64-l64-l74-l64-l74 /
https://github.com/dotnet/sdk/blob/e797c37a264bf5b3a478baff0a085309228e0dea/src/src/src/blazorwasmsmsdk/sdk/sdk/sdk/sdk.propsupp-l23-l23-l23-l23-l23-l23-l23-l23-l23-l23-l23-l23-l23-p27 https://github.com/dotnet/sdk/blob/e797c37a264bf5b3a478baff0a085309228e0dea/src/WebSdk/Worker/Targets/Microsoft.NET.Sdk.Worker.props#L41-L46
The compiler doesn't know anything about
ImplicitUsings
, it's an SDK feature. As @Guru Stron mentioned in a comment, you can add a syntax tree with the global usings to the compilation you're creating. The list of global usings can indeed vary.The global usings tree should ideally be in the form:
The main set are:
This list comes from https://github.com/dotnet/sdk/blob/e797c37a264bf5b3a478baff0a085309228e0dea/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.CSharp.props#L25-L34
See also
https://github.com/dotnet/sdk/blob/e797c37a264bf5b3a478baff0a085309228e0dea/src/WebSdk/Web/Sdk/Sdk.props#L64-L74
https://github.com/dotnet/sdk/blob/e797c37a264bf5b3a478baff0a085309228e0dea/src/BlazorWasmSdk/Sdk/Sdk.props#L23-L27
https://github.com/dotnet/sdk/blob/e797c37a264bf5b3a478baff0a085309228e0dea/src/WebSdk/Worker/Targets/Microsoft.NET.Sdk.Worker.props#L41-L46