jeudi 18 janvier 2018

Get value of a non-public member of sender object

I'm trying to use reflection and all the examples I've seen says this should work. I'm trying to get the PortName property as shown here.

This returns null:

var port = this.GetType().GetProperty("PortName", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetProperty);

enter image description here





Aucun commentaire:

Enregistrer un commentaire