Today saw a blog mentioned the use of reflection, did not think you can use this: you can use after reflection by putting a prefix "*" Find members include prefixes:
1
MemberInfo[] members
=
typeof
(A).GetMember(
"
hidden*
"
,
2 BindingFlags.NonPublic | BindingFlags.Instance);
3
4 // members now contains three members: hiddenFlag1, hiddenFlag2 and hiddenMethod
5
6 //
7
8 public class A
9 {
10 private bool hiddenFlag1;
11 private bool hiddenFlag2;
12
13 private void hiddenMethod()
14 {
15 }
16
17 private void reallyHiddenMethod()
18 {
19 }
20}
2 BindingFlags.NonPublic | BindingFlags.Instance);
3
4 // members now contains three members: hiddenFlag1, hiddenFlag2 and hiddenMethod
5
6 //
7
8 public class A
9 {
10 private bool hiddenFlag1;
11 private bool hiddenFlag2;
12
13 private void hiddenMethod()
14 {
15 }
16
17 private void reallyHiddenMethod()
18 {
19 }
20}
Reproduced in: https: //www.cnblogs.com/yangjie5188/archive/2008/02/22/1078188.html