vendredi 9 mars 2018

How to obtain a reference to the object a variable is a member of

I have a customer class:

Public Class Customer
   Public Name As String
End Class

And I pass the name to a subroutine, foo:

Dim myCustomer as New Customer
myCustomer.Name = "Bill"
Foo(myCustomer.Name)

Using Reflection, is there any way for Foo to obtain a reference to the MyCustomer instance that the name parameter is a member of?

Public Sub Foo (name As String)
   'Any way to obtain a reference to the MyCustomer instance from
   'the name parameter alone?
End Sub





Aucun commentaire:

Enregistrer un commentaire