c# - "+"在成员 c# 之后反射(reflect)的全名和 '*' 是什么意思#

标签 c# .net reflection

我目前正在处理 C# 中的反射。之后:

Assembly.LoadFile(@"C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.7\System.Numerics.Vectors.dll").GetTypes()

我发现了这个:[System.Numerics.Matrix4x4]、[System.Numerics.Matrix4x4+CanonicalBasis]、[System.Numerics.Matrix4x4+VectorBasis] (有来自“System.Numerics.Vectors.dll”的反射类型) 我知道 Matrix4x4 是结构,但是我找不到关于 CanonicalBasis 和 VectorBasis 的任何信息,以及“+”在这种情况下的含义。 我正在做进一步的研究,另一件奇怪的事情是:

Assembly.LoadFile(@"C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.7\System.Numerics.Vectors.dll").GetType("System.Numerics.Matrix4x4+VectorBasis").FullName
"System.Numerics.Matrix4x4+VectorBasis"

但是:

Assembly.LoadFile(@"C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.7\System.Numerics.Vectors.dll").GetType("System.Numerics.Matrix4x4+VectorBasis").Name
"VectorBasis"

此外,当我查看 Matrix4x4+VectorBasis 的成员时,有这样的成员:

[System.Numerics.Vector3* Element0] 

它是像 C++ 中那样的原始指针吗?或者它是什么?

附言我是用 c# interactive 做的,但我认为它对结果没有任何影响。

最佳答案

+类名之间表示+之后的部分是名称在 + 之前的类型的嵌套类型.例如Dictionary<string, string>+KeyCollection . KeyCollectionDictionary<TKey, TValue> 的内部类.

*确实表示一个指针,因为 the field mentioned处于不安全模式:

public unsafe Vector3* Element0;

关于c# - "+"在成员 c# 之后反射(reflect)的全名和 '*' 是什么意思#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50199317/

相关文章:

c# - 如何使用依赖注入(inject)完成可变对象重构?

.net - 使用 WiX 安装程序复制 Visual Studio COM 注册

c# - 不显示 .net 对象的属性和方法

c# - 将一个 C# 项目编译成另一个

c# - 强制执行特定数量的参数

c# - 在 Asp.Net Core 2.x 中使用查询字符串重定向

c# - 如何将控制中断(或等效信号)发送到 .NET 中的控制台应用程序进程?

c# - 仅通过提供字符串名称获取属性

c# - 递归迭代对象的属性

c# - 如何找到实现给定接口(interface)的所有类?