c# - How to read out protected member -
i want access protected member in class. there simple way?
there 2 ways:
- create sub-class of class protected members want access.
- use reflection.
#1 works if control creates instances of class. if already-constructed instance being handed you, #2 viable solution.
personally, i'd make sure i've exhausted other possible mechanisms of implementing feature before resorting reflection, though.
Comments
Post a Comment