MonoNativeFunctionWrapperAttribute 类    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
要应用于委托的属性,以将其标记为可与 一起使用 GetDelegateForFunctionPointer(IntPtr, Type)的目标。
[System.AttributeUsage(System.AttributeTargets.Delegate)]
public sealed class MonoNativeFunctionWrapperAttribute : Attributetype MonoNativeFunctionWrapperAttribute = class
    inherit Attribute- 继承
- 
				MonoNativeFunctionWrapperAttribute
- 属性
注解
由于 Xamarin.iOS 在完全静态编译模式下运行,因此有必要使用此属性标记可能传递给 的 GetDelegateForFunctionPointer(IntPtr, Type) 委托方法。 这指示 AOT 编译器生成必要的代码,以允许指向本机函数的指针为方法生成可调用的托管委托。
[MonoNativeFunctionWrapper]
delegate void SomeDelegate (int a, int b);
// 
// the ptrToFunc points to an unmanaged C function with the signature (int a, int b)
void Callback (IntPtr ptrToFunc)
{
	var del = (SomeDelegate) Marshal.GetDelegateForFunctionPointer (ptrToFunc, typeof (SomeDelegate));
	// invoke it
	del (1, 2);
}
构造函数
| MonoNativeFunctionWrapperAttribute() | 默认构造函数。 |