为什么ilspy上的方法全名带有斜杠?

问题描述 投票:0回答:1

我从 git 获取 Newtonsoft 项目并编译它。

当我打开程序集 dll 并检查一些完整的方法名称(完整的方法名称意味着方法的返回类型+命名空间+类+方法)时,我发现一些完整的方法名称在不同的地方带有斜杠。它可以位于返回类型的中间,可以位于命名空间上,也可以位于参数的中间

当我进入该方法的代码时,我没有找到任何“规则”。

谁能解释一下为什么它包含斜线?

(.net核心6.0)

在此输入图片描述enter image description here enter image description here

enter image description here

c# .net-core clr clr-profiling-api clrprofiler
1个回答
0
投票

根据 ECMA-335 (https://ecma-international.org/publications-and-standards/standards/ecma-335/):

对于嵌套类型,解析范围始终是封闭类型。 (参见第 II.10.6 节)。 这在语法上通过使用斜杠(“/”)来分隔封闭类型来指示 来自嵌套类型名称的名称。

此外,Newtonsoft.Json 是开源的,因此您可以直接查看源代码(ImmutableCollectionsUtils.cs):

internal static class ImmutableCollectionsUtils
{
    internal class ImmutableCollectionTypeInfo
    {
...
© www.soinside.com 2019 - 2024. All rights reserved.