次の方法で共有


FieldInfo.IsPinvokeImpl プロパティ

対応する PinvokeImpl 属性が FieldAttributes に設定されているかどうかを示す値を取得します。

Public ReadOnly Property IsPinvokeImpl As Boolean
[C#]
public bool IsPinvokeImpl {get;}
[C++]
public: __property bool get_IsPinvokeImpl();
[JScript]
public function get IsPinvokeImpl() : Boolean;

プロパティ値

FieldAttributesPinvokeImpl 属性が設定されている場合は true 。それ以外の場合は false

使用例

[Visual Basic, C#, C++] クラスを作成し、名前、フィールド、フィールドの IsPinvokeImpl プロパティの値を表示する例を次に示します。

 
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

[C#] 
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 );
    }
}

[C++] 
#using <mscorlib.dll>

using namespace System;
using namespace System::Reflection;

public __gc class Fieldinfo_IsPinvoke {
public:
   String* myField;
   Fieldinfo_IsPinvoke()
   {
      myField = S"A public field";
   }
};

int main()
{
   Fieldinfo_IsPinvoke* myObject = new Fieldinfo_IsPinvoke();

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

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

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

FieldInfo クラス | FieldInfo メンバ | System.Reflection 名前空間 | FieldAttributes