MethodImplAttributes 枚举
指定方法实现属性的标志。
**命名空间:**System.Reflection
**程序集:**mscorlib(在 mscorlib.dll 中)
语法
声明
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Enumeration MethodImplAttributes
用法
Dim instance As MethodImplAttributes
[SerializableAttribute]
[ComVisibleAttribute(true)]
public enum MethodImplAttributes
[SerializableAttribute]
[ComVisibleAttribute(true)]
public enum class MethodImplAttributes
/** @attribute SerializableAttribute() */
/** @attribute ComVisibleAttribute(true) */
public enum MethodImplAttributes
SerializableAttribute
ComVisibleAttribute(true)
public enum MethodImplAttributes
成员
成员名称 | 说明 | |
---|---|---|
![]() |
CodeTypeMask | 指定代码类型的标志。 |
![]() |
ForwardRef | 指定未定义此方法。 |
![]() |
IL | 指定此方法实现是用 Microsoft 中间语言 (MSIL) 编写的。 |
![]() |
InternalCall | 指定一个内部调用。 |
![]() |
Managed | 指定此方法实现是托管的,否则为非托管。 |
![]() |
ManagedMask | 指定代码是托管代码还是非托管代码。 |
![]() |
MaxMethodImplVal | 指定范围检查值。 |
![]() |
Native | 指定此方法实现是本机方法实现。 |
![]() |
NoInlining | 指定此方法无法被内联。 |
![]() |
OPTIL | 指定此方法实现是用优化中间语言 (OPTIL) 编写的。 |
![]() |
PreserveSig | 指定此方法签名完全按声明的样子导出。 |
![]() |
Runtime | 指定此方法实现由运行时提供。 |
![]() |
Synchronized | 指定此方法的整个方法体是单线程的。静态方法(Visual Basic 中的 Shared)在类型上锁定,而实例方法在实例上锁定。也可使用 C# 的 lock 语句(C# 参考) 或 Visual Basic 的 Lock、Unlock 函数 来实现此目的。 |
![]() |
Unmanaged | 指定此方法实现是非托管的,否则为托管。 |
备注
这些属性通过按位“或”运算组合在一起,如下所示:
Code Implementation Masks
CodeTypeMask
IL
Native
OPTIL
Runtime
Managed Masks
ManagedMask
Unmanaged
Managed
Implementation Information and Interop Masks
ForwardRef
PreserveSig
InternalCall
Synchronized
NoInlining
MaxMethodImplVal
提示
实例或类型上的锁定(如同使用 Synchronized 标志一样)对于公共类型是不推荐使用的,其原因在于除了不是自己的代码的其他代码可对公共类型和实例采用锁定。这可能导致死锁或其他同步问题。
平台
Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0
.NET Compact Framework
受以下版本支持:2.0、1.0