哪里nativeGetUninitializedObject实际上存在吗? [英] Where does nativeGetUninitializedObject actually exist?
问题描述
我很好奇一些序列化的东西,所以我绕到 FormatterServices
戳,发现名为 nativeGetUninitializedObject
实际的方法处理的初始化(而不调用custructor)给定类型的。这种方法是装饰用的extern
关键字和以下属性: [MethodImpl(MethodImplOptions.InternalCall),SecurityCritical]
I was curious about some serialization stuff so I went poking around FormatterServices
and found a method called nativeGetUninitializedObject
that actually handles the initialization (without calling the custructor) of a given type. This method is decorated with the extern
keyword and the following attribute: [MethodImpl(MethodImplOptions.InternalCall), SecurityCritical]
我在想:哪里这个方法实际上存在吗?什么代码执行CLR调用来获取初始化给定类型(不调用构造函数)?
I'm left wondering: where does this method actually exist? What code does the CLR call to get the given type initialized (without calling the constructor)?
推荐答案
这个方法实际上是在存在CLR的本地部分。在 MethodImplOptions.InternalCall
表示其转发到CLR本地代码和实现那里的呼叫。
This method actually exists in the native portion of the CLR. The MethodImplOptions.InternalCall
signifies a call which is forwarded to the CLR native code and is implemented there.
从的 MSDN 的:
指定一个内部调用。内部通话是被公共语言运行时本身内实现的方法的调用。
Specifies an internal call. An internal call is a call to a method that is implemented within the common language runtime itself.
这篇关于哪里nativeGetUninitializedObject实际上存在吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!