Get Private Variables using Reflection in VB.NET (URGENT)
Posted on 2006-11-09
I'm not sure if this is possible but here goes...
I know you can use reflection to get the public properties of the current object/class:
But I would like to get the private variables that are defined at the top of the class, see simple example below:
Public Class mySimpleClass
Private _FirstName As String
Private _LastName As String
Public ReadOnly Property Fullname() As String
Return _FirstName & " " & _LastName
Public Sub New()
I know that example doesn't show much, but basically I know I could access the Property 'FullName' using reflection, however if I want to access the private variables _FirstName and _LastName, how would I go about it? If it's possile at all.