Private Sub SetPrivateProperty(Of t)(
ByVal targertObject As t,
ByVal targetPropertyName As String,
ByVal targetPropertyValue As Object
)
Dim type As Type = targertObject.GetType
type.InvokeMember(targetPropertyName,
BindingFlags.NonPublic Or
BindingFlags.SetProperty Or
BindingFlags.Instance, Nothing,
targertObject, New Object() {targetPropertyValue})
End Sub
.net - Is it possible to set private property via reflection - Stack Overflow:
'via Blog this'
No comments:
Post a Comment