I want to change the property Controller.ModelState.IsValid manually for testing.
During reflection, I found that the definition of ModelState and ModelStae.IsValid is just {get;}
. So when I use PropertyInfo to reflect it , the SetMethod is null.
Then I tried to get backfield of it via GetRunningField, but what I found is 3 object: one "_innerdictionary
", and two "XXX<>_backfieldMethod
".That's not the same to the normal reflection for readonly property, there's no "<propertyname>K_backfield
" in it.
Is anyone who can help? I just want to make my test work easier.
Aucun commentaire:
Enregistrer un commentaire