How To Get A RuntimeMethodHandle?

How To Get A RuntimeMethodHandle?

Post by James Trefr » Thu, 12 Sep 2002 16:45:58



Hi,

I am trying to pass a MethodInfo object to my exception handler so I can get
the name of the method where the error occurred.  On the Full Framework, I
can use System.Reflection.MethodInfo.GetCurrentMethod(), but that is not
available in the CF.

Now I am trying to use System.Reflection.MethodInfo.GetMethodFromHandle, but
it requires a RuntimeMethodHandle.

*** So can anybody tell me how to get a RuntimeMethodHandle that represents
the current method? ***

Your help would be much appreciated.

Thanks,

- James

 
 
 

1. RuntimeMethodHandle

Could someone explain what the RuntimeMethodHandle is supposed to return?
I was trying to programmatically discover the current method name like so:

private void button1_Click(object sender, System.EventArgs e)

{

System.RuntimeMethodHandle rmh = new RuntimeMethodHandle();

System.Reflection.MethodBase mb =
System.Reflection.MethodInfo.GetMethodFromHandle(rmh);

MessageBox.Show(mb.Name);

I was hoping that this would return 'button1_Click'

Is this the correct way to go about this?

Thanks in advance!

Page

2. Amos pro update

3. BUG: Design view gets blank, (Was: Design view gets blank but exe is ok..)

4. Need---.Net developer with Active Directory SSO/SAML @ ATLANTA, GA

5. Tried installing twice, installer and installed VS.NET gets errors

6. Winalign

7. Just getting started - A little help?

8. sql*reportwriter 1.1 help needed!

9. Window gets automatically disposed at second connect

10. Getting List of Keywords Dynamically

11. How to see what gets serialised between server and client

12. problems in getting custom attributes in a structures element

13. Reg: Getting User Name and his role