Export (0) Print
Expand All

FieldInfo.IsPinvokeImpl Property

Gets a value that indicates whether the corresponding PinvokeImpl attribute is set in FieldAttributes.

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

public bool IsPinvokeImpl { get; }

Property Value

Type: System.Boolean
true if the field has the PinvokeImpl attribute set; otherwise, false.

ExceptionCondition
MethodAccessException

This member is invoked late-bound through mechanisms such as Type.InvokeMember.

The following example creates a class and displays the name, field, and IsPinvokeImpl property value of the field.


using System;
using System.Reflection;

public class Example
{
   public string myField = "A public field";

   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {
      Example myObject = new Example();

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

      // Display the name, field and the PInvokeImpl attribute for the field.
      outputBlock.Text += String.Format("\n Name of class: {0}", myType1.FullName);
      outputBlock.Text += String.Format("\n Value of field: {0}", myFieldInfo.GetValue(myObject));
      outputBlock.Text += String.Format("\n IsPinvokeImpl: {0}",
          myFieldInfo.IsPinvokeImpl);
   }
}


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft