c# - How to read out protected member -


i want access protected member in class. there simple way?

there 2 ways:

  1. create sub-class of class protected members want access.
  2. 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

Popular posts from this blog

Add email recipient to all new Trac tickets -

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -