我目前正在处理 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
. KeyCollection
是 Dictionary<TKey, TValue>
的内部类.
*
确实表示一个指针,因为 the field mentioned处于不安全模式:
public unsafe Vector3* Element0;
关于c# - "+"在成员 c# 之后反射(reflect)的全名和 '*' 是什么意思#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50199317/