FieldInfo.IsPinvokeImpl 属性

获取一个值,该值指示是否已在 FieldAttributes 中设置相应的 PinvokeImpl 属性 (Attribute)。

**命名空间:**System.Reflection
**程序集:**mscorlib(在 mscorlib.dll 中)

语法

声明
Public ReadOnly Property IsPinvokeImpl As Boolean
用法
Dim instance As FieldInfo
Dim value As Boolean

value = instance.IsPinvokeImpl
public bool IsPinvokeImpl { get; }
public:
virtual property bool IsPinvokeImpl {
    bool get () sealed;
}
/** @property */
public final boolean get_IsPinvokeImpl ()
public final function get IsPinvokeImpl () : boolean

属性值

如果在 FieldAttributes 中设置了 PinvokeImpl 属性 (Attribute),则为 true;否则为 false

示例

下面的示例创建一个类,并显示名称、字段以及字段的 IsPinvokeImpl 属性 (Property) 值。

Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic

Public Class Fieldinfo_IsPinvoke
    Public myField As String = "A public field"

    Public Shared Sub Main()
        Dim myObject As New Fieldinfo_IsPinvoke()

        ' Get the Type and FieldInfo.
        Dim myType1 As Type = GetType(Fieldinfo_IsPinvoke)
        Dim myFieldInfo As FieldInfo = myType1.GetField("myField", _
           BindingFlags.Public Or BindingFlags.Instance)

        ' Display the name, field and the PInvokeImpl attribute for the field.
        Console.Write(ControlChars.NewLine & "Name of class: {0}", _
                                         myType1.FullName)
        Console.Write(ControlChars.NewLine & "Value of field: {0}", _
                                         myFieldInfo.GetValue(myObject))
        Console.Write(ControlChars.NewLine & "IsPinvokeImpl: {0}", _
                                         myFieldInfo.IsPinvokeImpl)
    End Sub
End Class
using System;
using System.Reflection;

public class Fieldinfo_IsPinvoke
{
    public string myField = "A public field";
   
    public static void Main()
    {
        Fieldinfo_IsPinvoke myObject = new Fieldinfo_IsPinvoke();
      
        // Get the Type and FieldInfo.
        Type myType1 = typeof(Fieldinfo_IsPinvoke);
        FieldInfo myFieldInfo = myType1.GetField("myField",
            BindingFlags.Public|BindingFlags.Instance);

        // Display the name, field and the PInvokeImpl attribute for the field.
        Console.Write("\n Name of class: {0}", myType1.FullName);
        Console.Write("\n Value of field: {0}", myFieldInfo.GetValue(myObject));
        Console.Write("\n IsPinvokeImpl: {0}", 
            myFieldInfo.IsPinvokeImpl );
    }
}
using namespace System;
using namespace System::Reflection;

public ref class Fieldinfo_IsPinvoke
{
public:
   String^ myField;
   Fieldinfo_IsPinvoke()
   {
      myField = "A public field";
   }
};

int main()
{
   Fieldinfo_IsPinvoke^ myObject = gcnew Fieldinfo_IsPinvoke;

   // Get the Type and FieldInfo.
   Type^ myType1 = Fieldinfo_IsPinvoke::typeid;
   FieldInfo^ myFieldInfo = myType1->GetField( "myField", static_cast<BindingFlags>(BindingFlags::Public | BindingFlags::Instance) );

   // Display the name, field and the PInvokeImpl attribute for the field.
   Console::Write( "\n Name of class: {0}", myType1->FullName );
   Console::Write( "\n Value of field: {0}", myFieldInfo->GetValue( myObject ) );
   Console::Write( "\n IsPinvokeImpl: {0}", myFieldInfo->IsPinvokeImpl );
}
import System.*;
import System.Reflection.*;

public class FieldInfoIsPinvoke
{
    public String myField = "A public field";

    public static void main(String[] args)
    {
        FieldInfoIsPinvoke myObject = new FieldInfoIsPinvoke();

        // Get the Type and FieldInfo.
        Type myType1 = FieldInfoIsPinvoke.class.ToType();
        FieldInfo myFieldInfo = myType1.GetField("myField", BindingFlags.Public
            | BindingFlags.Instance);

        // Display the name, field and the PInvokeImpl attribute for the field.
        Console.Write("\n Name of class: {0}", myType1.get_FullName());
        Console.Write("\n Value of field: {0}", 
            myFieldInfo.GetValue(myObject));
        Console.Write("\n IsPinvokeImpl: {0}", 
            (System.Boolean)myFieldInfo.get_IsPinvokeImpl());
    } //main
} //FieldInfoIsPinvoke

平台

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

请参见

参考

FieldInfo 类
FieldInfo 成员
System.Reflection 命名空间
FieldAttributes 枚举