LocalVariableInfo Class (System.Reflection)_VB.htm : PropertyInfo « Reflection « VB.Net






LocalVariableInfo Class (System.Reflection)_VB.htm

 

Imports System
Imports System.Reflection

Public Class Example
    Public Shared Sub Main()
        Dim e As New Example()
        Console.WriteLine()
        e.MethodBodyExample("String argument")
        e.MethodBodyExample(Nothing)

        Dim mi As MethodInfo = GetType(Example).GetMethod("MethodBodyExample")
        Dim mb As MethodBody = mi.GetMethodBody()
        Console.WriteLine(mi)

        Console.WriteLine(mb.InitLocals)
        Console.WriteLine(mb.MaxStackSize)

        
        For Each lvi As LocalVariableInfo In mb.LocalVariables
            Console.WriteLine("Local variable: {0}", lvi)
        Next

    End Sub
    Public Sub MethodBodyExample(ByVal arg As Object)
        Dim var1 As Integer = 42
        Dim var2 As String = "Forty-two"
    End Sub
End Class

   
  








Related examples in the same category

1.PropertyInfo.Attributes Property gets the attributes for this property.
2.PropertyInfo.CanRead
3.PropertyInfo.CanWrite
4.PropertyInfo.GetAccessors
5.PropertyInfo.GetGetMethod returns the public or non-public get accessor for this property.
6.Get and display the GetGetMethod Method for each property
7.Display the GetGetMethod without using the MethodInfo
8.PropertyInfo.GetIndexParameters
9.Get Index Parameters
10.PropertyInfo.GetSetMethod
11.Display the GetSetMethod without using the MethodInfo
12.PropertyInfo.MemberType
13.PropertyInfo.PropertyType Property
14.PropertyInfo.SetValue