FieldInfo.IsPinvokeImpl Property
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Gets a value that indicates whether the corresponding PinvokeImpl attribute is set in FieldAttributes.
Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public ReadOnly Property IsPinvokeImpl As Boolean
public bool IsPinvokeImpl { get; }
Property Value
Type: System.Boolean
true if the field has the PinvokeImpl attribute set; otherwise, false.
Exceptions
Exception | Condition |
---|---|
MethodAccessException | This member is invoked late-bound through mechanisms such as Type.InvokeMember. |
Examples
The following example creates a class and displays the name, field, and IsPinvokeImpl property value of the field.
Note: |
---|
To run this example, see Building Examples That Use a Demo Method and a TextBlock Control. |
Imports System.Reflection
Public Class Example
Public myField As String = "A public field"
Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)
Dim myObject As New Example()
' Get the Type and FieldInfo.
Dim myType1 As Type = GetType(Example)
Dim myFieldInfo As FieldInfo = myType1.GetField("myField", _
BindingFlags.Public Or BindingFlags.Instance)
' Display the name, field and the PInvokeImpl attribute for the field.
outputBlock.Text &= String.Format("{0}Name of class: {1}", _
ControlChars.NewLine, myType1.FullName)
outputBlock.Text &= String.Format("{0}Value of field: {1}", _
ControlChars.NewLine, myFieldInfo.GetValue(myObject))
outputBlock.Text &= String.Format("{0}IsPinvokeImpl: {1}", _
ControlChars.NewLine, myFieldInfo.IsPinvokeImpl)
End Sub
End Class
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);
}
}
Version Information
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
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.