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