How would I code a "SetValue" extension that would allow me to set a property value like this. I know how to set the value using reflection but I don't know how to create an extension so it can be done like this...
Public Class Obj
Public Property myProp1 As String
Public Property myProp2 As Integer
End Class
Dim myObj As New Obj
'Here is what I want to do...
myObj("myProp1").SetValue("ABC")
myObj("myProp2").SetValue(42)
'Instead of..
myObj.myProp1 = "ABC"
myObj.myProp2 = 42
Thanks,AD
Aucun commentaire:
Enregistrer un commentaire