mercredi 16 mai 2018

Reflection PropertyInfo SetValue C#

Im using reflection to get a property. I then want to change the value of this property.

For this example I want to get the property of type Task and overwrite that property value with a different Task object. This is my code so far. It's currently getting the Task PropertyInfo but I don't know what to put in the 1st parameter of the SetValue call.

var viewBindingProperty = viewBinding.GetType().GetProperty(typeof(Task).Name);

viewBindingProperty.SetValue(??, pageBinding.Task);

I need to overwrite the value of the Task Property value in the viewBindingProperty with pageBinding.Task





Aucun commentaire:

Enregistrer un commentaire