E
ewolfman
Hi,
I'm trying to retrieve a private method using reflection, which exists
in my ASP.NET Page.
It works only if I change the method's accessor to 'protected'.
BTW: this occurs only for Page's private methods; if I create a new
class within the page's file, it works fine.
protected void Page_Load(object sender, EventArgs e)
{
Type type = this.GetType();
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance |
BindingFlags.NonPublic);
foreach (MethodInfo method in methods)
{
if (method.Name.Equals("AA"))
{
int a = 0; // place breakpoint here
}
Debug.WriteLine(method.Name);
}
}
protected void AA() // change this to 'private' and rerun....
{
}
}
Please assist.
Thanks.
I'm trying to retrieve a private method using reflection, which exists
in my ASP.NET Page.
It works only if I change the method's accessor to 'protected'.
BTW: this occurs only for Page's private methods; if I create a new
class within the page's file, it works fine.
protected void Page_Load(object sender, EventArgs e)
{
Type type = this.GetType();
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance |
BindingFlags.NonPublic);
foreach (MethodInfo method in methods)
{
if (method.Name.Equals("AA"))
{
int a = 0; // place breakpoint here
}
Debug.WriteLine(method.Name);
}
}
protected void AA() // change this to 'private' and rerun....
{
}
}
Please assist.
Thanks.