I see that the \"Quick Watch\" window has access to all properties, irrespective of access restrictions (internal, protected, private) of a class in a library, even when the
Use these flags
BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance
The GetProperty
flag is not required for this operation. You might want to add Static
as well.
Note: You can combine the flags with |
, because their integer values are powers of two. See this SO answer.
NOTE (In response to Lalman's and shanks's concern about security issues of Reflection)
There is always a way to write bad or dangerous code. It is up to you to do it or not. Reflection is not the regular way of doing things, rather is it meant for the programming of special tools, like o/r-mappers or analysis tools. Reflection is very powerful; however, you should use it wisely.