Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic
Public Class MyClass1
Protected myField As String = "A sample protected field."
End Class 'MyClass1
Public Class MyType_IsAnsiClass
Public Shared Sub Main()
Try
Dim myObject As New MyClass1()
Dim myType As Type = GetType(MyClass1)
Dim myFieldInfo As FieldInfo = myType.GetField("myField", BindingFlags.NonPublic Or BindingFlags.Instance)
Console.WriteLine(myType.FullName)
Console.WriteLine(myFieldInfo.GetValue(myObject))
Console.WriteLine(myType.IsAnsiClass)
Catch e As Exception
Console.WriteLine("Exception: {0}", e.Message.ToString())
End Try
End Sub
End Class